Topic 1 Flashcards
Define the term ‘algorithm’
A series of instructions that describes how to solve a specific problem
Define the term ‘pseudocode’
A cross between English and a generic-looking programming language. While pseudocode would not compile, a competent programmer could convert it to code that would compile.
Define the term ‘flow chart’
A means of defining an algorithm using shapes and arrows
Define the flow chart shape ‘terminator’
Is used to mark the start, and another is used to mark the end. They are not used anywhere else
What do arrows do in flow charts?
Arrows show which instruction should take place next
Define the flow chart shape ‘decision’
It asks a question, and each arrow leaving this shape must have one possible answer to the question written alongside it
Define the flow chart shape ‘process’
Each one contains a single instruction, so complex tasks usually incorporate several processes.
Control structures:
Define ‘sequence’
When instructions in an algorithm each need to be executed only once, and in the order in which they are written
Control structures:
Define ‘selection’
When one sequence of instructions or another, but not both, is executed. The sequence that is executed will depend on what happened in earlier instructions.
Control structures:
Define ‘iteration’
Takes place when one or more instructions is executed more than once. Iteration is also known as repetition. Iteration is taking place when program code (or pseudocode) contains the words LOOP, FOR, WHILE or REPEAT.
Define ‘trace table’
Used to keep track of variables that change throughout the algorithm
Define ‘standard algorithm’
One the would appear in many different programs. It is an algorithm required so often, in so many applications, that virtually all software developers know exactly how it works and how to program it.
Define ‘sorting’
Putting data into order, whether that be numerical order, alphabetical order or chronological order, ascending (A-Z) or descending (Z-A)
Bubble sort ( 4 2 7 5 3 )
First pass:
( 2, 4, 7, 5, 3 ) – 2 and 4 been switched bc 4 is greater than 2
( 2, 4, 7, 5, 3 ) – 4 and 7 not switched bc they are already in order
( 2, 4, 5, 7, 3 ) – 5 and 7 been switched bc 7 is greater than 5
( 2, 4, 5, 3, 7 ) – 3 and 7 been switched bc 7 is greater than 3
This then continues til it gets to ( 2, 3, 4, 5, 7, 3)
Merge sort ( 4 9 5 1 3 2 7 8 )
Split: (4) (9) (5) (1) (3) (2) (7) (8) Pair: (4 9) (5 1) (3 2) (7 8) Pairs merged into groupings of four: (4 9) (5 1) 4 and 1 compared and the smallest is 1 leaving (1) 5 and 4 compared= (1 4) 9 and 5 compared= (1 4 5 9) Same goes for (3 2 7 8)......(2 3 7 8) (1 4 5 9) (2 3 7 8) the compared: 1. (1) 2. (1 2) 3. (1 2 3) 4. (1 2 3 4) ... 8. (1 2 3 4 5 7 8 9)