2.1 - producing algorithms Flashcards
Algorithms in pseudocode
Most programs are written using programming language. They have specific syntaxes that need to be used
What is pseudocode
It is not an actual programming language. Instead, it is a simple way of describing a set of instructions in a manner that resembles a programming language. It has its own syntax, some of which is very similar to many actual programming languages. Any algorithms designed using pseudocode will not run unless they are converted into an actual programming language.
Advantages of pseudocode
- pseudocode is similar to a programming language, it can be quickly and easily converted into an actual programming language
- fairly easy to understand, even for non-programmers
- does not matter if there are errors in the syntax - it is usually still obvious what is intended
- changes to the design can be incorporated quite easily
Disadvantages of pseudocode
- can be hard to see how a program flows
- can be time consuming to produce
What is a flow diagram
A diagram that shows an overview of a
program. Flow diagrams normally use standard symbols to represent the different types of
instruction. These symbols are used to construct the flowchart and show the step-by-step solution to the problem. Flow diagrams are sometimes known as flowcharts.
What does a line in a flow diagram represent
Flow from one component to the next
What does a rectangle in a flow diagram represent
Process - an action
What does a rectangle with two lines represent in a flow diagram
Subroutine
What does a parallelogram in a flow diagram represent
Input/ output
What does a diamond in a flow diagram represent
Decision
What does a round rectangle in a flow diagram represent
Start/ stop
Two types of programming problems
Logic
Syntax
What is a syntax error
A syntax error occurs when code written does not follow the rules of the programming language. A program will not run if it has syntax errors. Any such errors must be fixed first.
What is a logic error
A logic error is an error in the way a program works. The program simply does not do what it is expected to do.