1 - Fundamentals of Algorithms Flashcards
What is an algorithm?
e.g. directions
An algorithm is a sequence of steps that can be followed to complete a task. A computer program is an implementation of an algorithm and an algorithm is not a computer program
What is decomposition?
e.g. recipe
Decomposition is breaking a problem into a number of sub-problems, so that each sub-problem achieves an identifiable task, which might itself be further subdivided
What is abstraction?
e.g. London tube map
Abstraction is the process of removing unnecessary detail from a problem
What is a model for how a computer operates?
The input-process-output model helps to show how a computer operates.
What is the input stage in a computer, and where does it take place in the algorithm?
The input stage is the flow of data into the process from outside the system. It takes place at the start of the algorithm
What is the process stage in a computer, and where does it take place in the algorithm?
The process stage includes all the tasks required to affect a transformation of the inputs. It takes place in-between the input and output stage
What is the output stage in a computer, and where does it take place in the algorithm?
The output stage is where the data and information flow out of the transformation process, and it takes place at the end of the algorithm
What are flowcharts?
Flowcharts are diagrams that represent an algorithm
What does the flow line mean?
The flow line shows the sequence of operations. These must go in through one box and out of the other.
What does a terminal symbol mean?
The terminal symbol denotes the start or end of the algorithm
What does the processing symbol mean?
The processing symbol denotes a process to be carried out
What does a decision symbol mean?
A decision symbol is used to represent the operation in which there are 2 alternatives
What structures can be used for flowcharts?
Sequence, Selection and Iteration structures
What is pseudocode?
Pseudocode is a way of developing an algorithm, which consists of natural language-like statements that precisely describe the steps required
What are assignment operators?
Operators that set the value of the variable in pseudocode
How do you input something in pseudocode?
VAR
How do you output something in pseudocode?
OUTPUT (or PRINT, DISPLAY, SHOW, RETURN) ‘information’
How do you process or compute something in pseudocode?
COMPUTE, CALCULATE, DETERMINE
How do you comment on your pseudocode?
By using # key
How do you add selection in pseudocode?
By using IF, THEN, ELSE, ENDIF statements
How do you represent pseudocode as a flowchart (and vice versa)?
By matching each statement with whether it is an input, output, process, terminal or decision statement
How do we use a trace table to identify how simple algorithms work?
A trace table is a technique used to see if any logic errors are occurring whilst the algorithm is being processed
How can visual inspection be used to see how a simple algorithm works?
By looking at it to see if any logic errors occur based on the expected outcome and the actual outcome of the algorithm
What types of loops can be used in pseudocode?
FOR loop, WHILE loop, REPEAT … UNTIL loop