1.1 Algorithms

An algorithm is a well-defined computational procedure that takes input, performs a finite sequence of steps, and produces output. It’s both a step-by-step process and a tool for solving computational problems — each problem defines an input–output relationship, and the algorithm provides the specific method to achieve it.

Example – Sorting problem:

Correctness:

An algorithm is correct if it halts (finishes its computing in finite time) and always produces the right output.

Incorrect algorithms may still be useful if their error rate is controlled.

Applications of algorithms:

Algorithms often tackle problems with an enormous number of possible solutions, where testing each option is infeasible. Instead, they find efficient ways to reach correct or optimal results.

Examples include:

All these problems share two key traits:

  1. They involve a vast space of potential solutions but need efficient methods to find the right or best one.
  2. They have strong practical applications — in navigation, communication, healthcare, manufacturing, and data processing.

Some problems, like the Fourier transform, don’t have a clear set of discrete candidate solutions but still rely on algorithmic procedures to compute results efficiently.

Data structures

Organize and store data to enable efficient access and modification. Choosing the right structure is crucial for designing effective algorithms.