An algorithm is a procedure or formula for solving a problem, based on conducting a sequence of specified actions that produces some output.
Key Features
- Step by step set of instructions
- Sequential
- Generate some output
Key Characteristics
- Input - O or more
- Output - 1 or more
- Definiteness - non ambigious, algorithm should convey a definite concept.
- Finiteness - should end
- Effectiveness - non technical also can work on it.
Advantages
- It acts as weapon in your arsenal. Eg: sorting, searching algorithms.
- Learning process
- Making abstraction - hiding complex details
- Topic for talk - research
Specification of Algorithms (describing algorithms)
- Flowchart
- Natural language
- Pseudocode
- Function notation (recursive function)
$$ f_{n} = n_{n-1} + n_{n-2} $$