An algorithm is a step by step procedure to solve a problem
Example: suppose you want to eat an apple, so what steps you will take to eat an apple
Step1: take an apple
Step2: wash with water
Step 3: cut the apple with a knife into four piece’s
Step4: eat each piece one by one till you finish it
So here are the four steps that you need to eat an apple. These four steps are nothing but the algorithm to eat an apple
An analogy of algorithm
You can think algorithm as a recipe, same as recipes we need in order to make a certain food. Like how much amount of salt needed, at what boiling point you have to mix the rice in the water when to add oil, so in a way algorithms are recipes to solve a problem
Another analogy of algorithm
An algorithm is a procedure, which takes some input values and produces some output values
Example: given input sequences of number (15, 24, 77, 68, 25) then a sorting algorithm(reordering) gives an output(15, 24, 25, 68,77)
What kind of problems algorithms solve?
Determining all the 100,000 genes in DNA of human, storing information in the database require sophisticated algorithms, the internet we use and also over the world people can access information with the help of algorithms, finding the good routes during traveling.
Which algorithm is best?
We have a large number of algorithms at our disposal then how to choose? it depends on the factors such as the number of items to be sorted, the computer architecture and what kind of storage devices you used.