Step 2: The Grammar of Algorithms: Formal Definition & Al-Khwarizmi's Legacy
An algorithm is a deterministic computational recipe that transforms valid input into guaranteed output.

1. Etymology & Historical Heritage
- Origin: Named after Muhammad ibn Musa al-Khwarizmi (c. 780โ850 CE).
- His monumental work Kitab al-Jam' wa'l-tafriq bi-hisab al-Hind systematically introduced the Indian decimal place-value system and algorithmic operations across the medieval world.
2. The Four Pillars of an Algorithm
Every algorithm must rigorously demonstrate:
- Finiteness: Must terminate after a finite, countable number of steps for all valid inputs.
- Definiteness: Every operation is clear, unambiguous, and leaves zero doubt about execution.
- Input / Output: Takes zero or more specified inputs, and produces one or more well-defined outputs.
- Effectiveness (Feasibility): Every step can be performed mechanically using finite resources in finite time.
3. Representation Formats
- Pseudocode: High-level structured language outlining logical steps.
- Flowchart: Graphical flowchart with standard geometric nodes:
- Oval: Start / End
- Parallelogram: Input / Output
- Rectangle: Process / Computation
- Diamond: Decision / Conditional Branching ($Yes / No$)