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
Define:
Program Code
Code written to solve the problem which follows the rules of a selected programming language
State:
3 advantages of using (draft) program code to represent an algorithm
- Very probable the person creating the algorithm will have programming knowledge
- Not necessary to use the correct syntax
- All the required constructs will be available to be included in draft code
State:
2 disadvantages of using program code to represent an algorithm
- Easy to begin creating draft code but end up creating the final program code
- Full decomposition may not be completed
Define:
Dry Run
Manually working through the code to trace the value of variables
Define:
Trace Table
Tool used to test or dry run algorithms to make sure no logical errors occur while calculations are being processed
State:
2 ways to test/check an algorithm works
- Visual Check
- Trace Table
State:
2 advantages of using pre-written/library code
2 of:
* Save development time
* Save testing time
* Will be optimised (more efficient and error free)
State:
1 disadvantage of using pre-written/library code
It may not be exactly what is required and may require editing to work for an unique problem
Fill The Blank:
A ……….. check can be used to determine the purpose of the algorithm using pseudocode
Visual