What is an Algorithm?
Rhombus
Input/output
Give a general definition for an algorithm.
An algorithm is a finite sequence of precise instructions for performing a computation or solving a problem. OR An algorithm is a well defined sequence of instructions that describe a process or a systematic generic solution of an engineering problem.
Sequential
First do X, then do Y, then do Z
Pentagon
Off page
Circle
On page
Oval
Start/end
Divided rectangle
Subroutine
Pseudocode
● A linear written algorithm (narrative set of instructions) to solve an engineering problem ● Every step included must not be subject to misinterpretation ● Clear list of actions and decisions
Flow diagrams
● Start, Input, Processing, Output, End ● Shapes have specific meanings ● Arrows show flow of control
Arrow
Control flow
Conditional
If some condition is met, then do X, else do Y
Flow diagram shapes
*insert picture*
Name the properties of algorithms.
1. Input 2. Output 3. Definiteness 4. Correctness 5. Effectiveness 6. Finiteness 7. Generality *Use Haley's Song*
Diamond
Conditional test or decision
Concurrency structures
Do X and Y at the same time
Rectangle
Process instruction
Repetition (parallel)
Repeat X N times (for loop) Repeat X until a condition is met (while loop)