What is an Algorithm in Programming | DSA Tutorials YASH PAL, 11 February 20205 May 2026 Algorithm in Programming – In programming, an algorithm is a step-by-step method for solving a problem. In other words, we can say that an algorithm has a finite sequence of instructions. And in order to solve a particular problem, we need a precise and step-by-step method. Not in terms of programming, but in our daily lives, we need a step-by-step plan to do any work.Algorithm meaning in programmingAn algorithm is a finite set of instructions that, when followed by these instructions, can accomplish a particular task. In addition, all algorithms must satisfy the following criteria while solving a particular programming problem:Input – Zero or more quantities are externally supplied.Output – At least one quantity is produced.Definiteness – Each instruction is unambiguous.Finiteness – If we trace out the instructions of an algorithm, then for all cases, the algorithm terminates after a finite number of steps.Effectiveness – Every instruction must be very basic so that it can be carried out, in principle, by a person using only a pencil and paper.An algorithm is a well-defined list of steps for solving a particular problem. The time and space it uses are two major measures of the efficiency of an algorithm. The complexity of an algorithm is the function that gives the running time or space in terms of the input size.How to obtain an Algorithm in programmingTo obtain an algorithm or to write an algorithm, we need three things: input, a sequence of instructions to process the input, and the last result of the algorithm.Inputa sequence of instructions to process the input.ResultFigure 1: Algorithm in ProgrammingFormat of Algorithm PresentationThe format for the presentation of an algorithm consists of two parts – The first part is a paragraph that tells the purpose of the algorithm, identifies the variables that occur in the algorithm and lists the input data. The second part consists of the list of steps that are to be executed.For example, to make a recipe for making potato bonds, we need a step-by-step process we first need the list of ingredients, and then the making method and then the expected result will come.Ingredients – Potatoes 250 grams, chopped onions, finely chopped green chillies, gram flour, oil for frying, water for the batter, salt, etc…Algorithm MethodStep 1: Boil potatoes till cooked, peel and mash them until they are soft. Step 2: Mix fried onions, green chillies, and salt with the mashed potatoes. Step 3: Take little portions of the mixture and make small balls.Step 4: Mix gram flour, water, and a little salt and beat well till a smooth and creamy batter is obtained. Step 5: Dip the potato balls in the batter. Take out and deep fry in oil on a low fire.Step 6: Take out when the balls are fried to a golden brown colour. Result – Potato bonds are ready.In the above example, the Ingredients work as an input. and the method is working as a sequence of instructions. And then the result comes out as our potato bonds are ready.Characteristics of AlgorithmAn algorithm has the following five basic characteristicsFirst: an algorithm begins with instructions to accept inputs. These inputs are processed by the subsequence and sequence of instructions in the algorithm. Second: The sequence of instructions specified in the algorithms must be precise and unambiguous. and not be vague. Third: Each instruction must be sufficiently basic such that it can be carried out by a person with paper and pencil. Fourth: The total time consumed by the algorithm must be finite. Five: An algorithm must produce one or more outputs.Let’s take another technical example.A step-by-step procedure to find the average number of vowels in a passage.Step 1: Let the number of characters = 0Step 2: Let the number of vowels = 0Step 3: Repeat Steps 4, 5, 6, and 7 until no more characters are left in the passage. Step 4: Read one character from the passage.Step 5: Add 1 to some characters.Step 6: If the character is any one of the letters A, E, I, O, U, a, e, I, o, u, add 1 to the number of vowels.Step 7: Move to the next character. Step 8: Average Number of vowels = Number of vowels / Number of charactersStep 9: Write the average number of vowels and several characters.Step 10: Stop.And in the above process to find the average number of vowels in a passage is an algorithm because it has several inputs, a finite number of sequences and instructions and terminates on a condition and has a sufficient output.Data Structures & Algorithms Tutorials for Beginners Data Structures Tutorials DSA Tutorials