3.3 Algorithms and Programs Flashcards
Algorithm
A series of steps to solve a specific problems.
3 methods of defining algorithms
- Flowcharts
- Pseudocode
- Structured English
2 advantages of flowcharts
- Easy to write
- Easy technique to understand logic
2 disadvantages of flowcharts
- Time Consuming
- Difficult to show branching and looping
3 advantages of pseudocode
- Forces programmer to think through logic of code before writing
- Easier to understand the concept of a program.
- Easier to convert a flow diagram
2 disadvantages of pseudocode
- No accepted standard so varies wildly
- More difficult to follow logic in comparison to flowcharts
structured English
A cross between pseudocode and plain English.
Advantage of structured English
Easy for non-programmers to write.
2 disadvantages of structured English.
- No accepted standard so varies wildly
- Can be difficult to convert to code.
variable
A named space in the memory for a single piece of data.
constant
A variable except the data can not be changed in the program.
two scopes of a variable
- Local
- Global
Global variable (2)
Available throughout the program
Can be read /written from any subroutine.
2 advantages of local variable
Variable data is only significant in the subroutine is it being used.
Encourages the use of modular programming
local variable
Only exists until the subroutine in which it was created.