Back to course

Lesson 1: What is an Algorithm?

Algorithms: From Zero to Hero (A Beginner's Guide)

1. What is an Algorithm?

An algorithm is fundamentally a set of well-defined steps or instructions for completing a task or solving a specific problem. Think of it as a recipe for your computer.

Key Characteristics

  1. Input: An algorithm must accept zero or more inputs (data to process).
  2. Output: It must produce at least one output (the result).
  3. Definiteness: Each step must be clear and unambiguous.
  4. Finiteness: It must terminate after a finite number of steps.
  5. Effectiveness: Every instruction must be basic enough to be carried out.

Examples in Daily Life

  • Making Tea: (1) Boil water, (2) Add tea bag, (3) Steep, (4) Add milk/sugar (optional).
  • Finding a Contact: (1) Open phonebook, (2) Look for the first letter, (3) Scan alphabetically.

In programming, algorithms are used to sort lists, search databases, calculate routes (like Google Maps), and much more.