Please enable JavaScript.
Coggle requires JavaScript to display documents.
Problem Solving (Algorithms: (Pseudo-code: way of expressing an algorithm…
Problem Solving
Algorithms:
Pseudo-code: way of expressing an algorithm in structured English. Uses commands, keywords and structures similar to computer language.
Advantages: quickly and easily converted, easily understandable, doesn't matter about syntax
Disadvantages: Time consuming production, hard to see how it flows
Flowcharts:
Rounded rectangle- marks beginning and end
Diamond - decision
Rectangle - process
Rhombus- Input/Output
Line - direction of control
Advantages:easily to follow, known by everyone
Disadvantages: Difficult for large programs, changes aren't easy to make.
-
Constructs:
Sequence: instructions given in the correct order
Selection: Decisions made and course of action selected
Iteration: previous steps are required until there is a desired outcome
Errors
Syntax- includes misspelling statements, using variables before it has been declared or missing brackets or speech marks etc.
Logic- error in the way the program works. Includes incorrectly using Logical or Boolean operators. Unintentionally using an infinite loop.Incorrectly using brackets in calculations. Unintentionally using same variable name at different points in the program for different purposes. Using incorrect program design.
Runtime- error that takes place when the program is running, likely to crash.
Debugging: process of identifying errors and then either correcting them or determining a way to work around them. Starts when code is written and continues as code is combined.
Computational Thinking
Decomposition: reduces a problem into sub-problems or components. These smaller parts are easier to understand or solve.
Abstraction:Identifies essential elements that must be included in the computer models and discards inessential ones
Investigating requirements:
Inputs: Data entered by user
Outputs: Data displayed to the user
Processing: how the rules will be coded
Initialisation: variables set at beginning
Searchs
Linear: is sequential algorithms moves through each item until the wanted one is found or end of list is reached.
Best case: search item is the first value. Worse case: it's the last value.
Binary: compares search item with the median item in a list, repeatedly splits list in half until item is found or there is no more items left to search.
List must already be in ascending order, the median is selected and compared with search item, if its lower the median and above is discarded and vice versa, a new median is calculated and process is repeated
Best case: the search item is the median. Worse case: median is the largest each time there is more to search depending on the quantity in the list
Sorting
Bubble: Data sorted into ascending or descending order
Completed by selecting the first two items of the list, if they are not in the correct order they are swapped, if they are correct they are kept the same. The second and third are checked and the process is repeated. It reaches the end of the list the a second pass is done where the process is repeated checking the order.
Merge: breaks a list into its component parts and builds it again in correct order.
Completed by setting the list in half over and over again until it is in to a pair. They are compared with each other and put in the correct order. This is then compared with another pair and another until they are all together again.
Trace Tables: Help programmers to determine the point in a program where a logic error has occurred. Columns for each of the variable and input/output values which enable programmers to compare what the value of each variable should be against what a program actually produces to find the error