1.2.1 + 1.2.4 What algorithms are and how they are expressed The purpose of a given algorithm and how it works Flashcards
Define:
Algorithm
A well-defined set of step-by-step instructions to solve a problem
Fill The Blank:
An algorithm is language ………………
Independent
State:
Give 4 requirements of an algorithm
- Clear
- Clear defined outputs and inputs
- Simple
- Language independent
State:
3 advantages of an algorithm
- Easy to understand by anyone
- Step by step representation of a solution to a given problem
- Initial problem is broken down into steps, which means it is easier to convert into code
State:
2 disadvantages of algorithms
- Can be time consuming to create
- Some constructs can be difficult to represent
State:
The 4 ways an algorithm can be represented
- Flowchart
- Written Description
- Pseudocode
- Program Code
Define:
Flowchart
Graphical diagram that represents an algorithm which can be used to solve a problem
State:
2 advantages of using a flowchart to represent an algorithm
- Flow of the algorithm can be seen clearly
- Flowcharts are created using a standardised set of symbols so can be interpreted and understood by many people
State:
2 disadvantages of using a flowchart to represent an algorithm
- Can become large and difficult to follow when representing a large program
- Changes to design may result in the flowchart being amended or redrawn
Fill The Blank:
Written descriptions should be in …………… language or plain English. There is no set of …….. to follow when using written description but they should be …….., ……… and contain few/no specific ………
Natural, Rules, Clear, Simple, Details
State:
2 advantages of using a written description to represent an algorithm
- No formal syntax, so many people can create a written description
- Automatic and natural to use ‘proper’ English
State:
2 disadvantages of using a written description to represent an algorithm
- Temptation to create a complete description (complicating it)
- Failure to include every step required
Define:
Pseudocode
An informal description that shows the flow of an algorithm and follows a similar structure to high level languages
State:
3 advantages of using pseudocode to represent an algorithm
3 of:
* Can be converted into programming code with only minor changes to obey syntax of the language
* Can be easy to follow and understand even if errors are present in the pseudocode
* Changes can be added in quickly
* Can act as a link between the algorithm and the final program
* Explains the purpose of each line of code
State:
2 disadvantages of using pseudocode to represent an algorithm
- Can be time consuming to write clear and well structured pseudocode to write the final program code
- Can be difficult to see the logical flow of the program