In mathematics and computer science, an algorithm is a self-contained step-by-step set of operations to be performed to solve a mathematical problem or to complete a computer process.

Algorithms can be expressed in natural languages, pseudocode, flowcharts, programming languages or in any understandable form.

In Software world, an optimal algorithm would produce faster results than a non optimal algorithm for the same purpose, regardless of programming language and hardware used.

Example of Some Simple Algorithms

Quick sort: an efficient sorting algorithm to place elements of collection (e.g. an array) in order.

Bubble sort: compares each pair of adjacent items and swaps them if they are in the wrong order.

Linear Search: a simple search algorithm that finds an item in an unsorted sequence of collection.

Binary search: locates an item in a sorted sequence.