)
What is an Algorithm
Algorithm refers to a set of rules and instructions that defines how a task is to be executed upon in order to get the expected results. Algorithm defines the output based on set of rules that applies to input data. Therefore, it is important to define input and output before setting the rules and instructions for the algorithm to work. In cases where the input is not defined properly, the algorithm sometime delivers inconsistent output results.
Let’s take example of a smartphone to understand how algorithm works:
In auto brightness mode, the smartphone’s display adjusts the screen brightness based on ambient light conditions. In dark environment, the screen dims down the brightness. It boosts the brightness in bright light conditions. This is a work of algorithm. The input here is ambient lighting. Algorithm is a set of instructions that modifies smartphone's system settings to change display brightness levels. Output is screen brightness, which changes with environment.
Algorithm design is language-independent, i.e. they are set of instructions that can be implemented in any language. Importantly, it yields similar results irrespective of the language it is executed in.
Algorithms are essential to the way computers process data. Many computer programs contain algorithms that detail the specific instructions a computer should perform—in a specific order—to carry out a specified task, such as calculating employees' pay checks or printing students' report cards.