Introduction to Algorithms

Introduction to Algorithms

An algorithm is a step-by-step instruction to solve a given problem efficiently for a given set of inputs. It is also viewed as a tool for solving well-defined computational problems or a set of steps that transform the input into the output. Algorithms are language-independent and are said to be correct only if every input instance produces the correct output.

The Instance of the Problem

The input of the algorithm is called an instance of the problem, which should satisfy the constraints imposed on the problem statement.