Skip to content
Programmingoneonone
Programmingoneonone
  • Engineering Subjects
    • Internet of Things (IoT)
    • Digital Communication
    • Human Values
  • Programming Tutorials
    • C Programming
    • Data structures and Algorithms
    • 100+ Java Programs
    • 100+ C Programs
    • 100+ C++ Programs
  • Solutions
    • HackerRank
      • Algorithms Solutions
      • C solutions
      • C++ solutions
      • Java solutions
      • Python solutions
      • Data Structures Solutions
    • Leetcode Solutions
    • HackerEarth Solutions
  • Work with US
Programmingoneonone
Programmingoneonone

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 programming

An 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:

  1. Input – Zero or more quantities are externally supplied.
  2. Output – At least one quantity is produced.
  3. Definiteness – Each instruction is unambiguous.
  4. Finiteness – If we trace out the instructions of an algorithm, then for all cases, the algorithm terminates after a finite number of steps.
  5. 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 programming

To 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.

  1. Input
  2. a sequence of instructions to process the input.
  3. Result
What is Algorithm in Programming
Figure 1: Algorithm in Programming

Format of Algorithm Presentation

The 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 Method

  • Step 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 Algorithm

An algorithm has the following five basic characteristics

  1. First: an algorithm begins with instructions to accept inputs. These inputs are processed by the subsequence and sequence of instructions in the algorithm. 
  2. Second: The sequence of instructions specified in the algorithms must be precise and unambiguous. and not be vague. 
  3. Third: Each instruction must be sufficiently basic such that it can be carried out by a person with paper and pencil. 
  4. Fourth: The total time consumed by the algorithm must be finite. 
  5. 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.

  1. Step 1: Let the number of characters = 0
  2. Step 2: Let the number of vowels = 0
  3. Step 3: Repeat Steps 4, 5, 6, and 7 until no more characters are left in the passage. 
  4. Step 4: Read one character from the passage.
  5. Step 5: Add 1 to some characters.
  6. 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.
  7. Step 7: Move to the next character. 
  8. Step 8: Average Number of vowels = Number of vowels / Number of characters
  9. Step 9: Write the average number of vowels and several characters.
  10. 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

Post navigation

Previous post
Next post

Programmingoneonone

We at Programmingoneonone, also known as Programming101 is a learning hub of programming and other related stuff. We provide free learning tutorials/articles related to programming and other technical stuff to people who are eager to learn about it.

Pages

  • About US
  • Contact US
  • Privacy Policy

Practice

  • Java
  • C++
  • C

Follow US

  • YouTube
  • LinkedIn
  • Facebook
  • Pinterest
  • Instagram
©2026 Programmingoneonone | WordPress Theme by SuperbThemes