Algorithm Tutorials

What is an Algorithm?

In computer science, an algorithm is a set of well-defined, unambiguous instruction to solve a particular problem in such an effective way that will take the shortest time, less memory space to run. For example, obtaining a required output for any legitimate input in a finite amount of time.

DSA Tutorial Algorithm Basic
Basic Algorithm

Algorithm Example

Now we will try to understand the algorithm by an example. We will write an algorithm to add two numbers.

An algorithm to add two numbers entered by the user.

Step 1: START
Step 2: Define variables x, y, and sum
Step 3: Ask for two numbers from the user and store in x and y
Step 4: Add x + y and assign the result in the sum
Step 5: Display result of the sum
Step 6: END

From the above example, we have represented the algorithm for adding two numbers. Basically, In real-world applications, we probably face many complex problems. Some problems can be solved in many ways that means by following many algorithms.

But all the algorithms won’t be a good algorithm or quality algorithm until they met some conditions and maintains some fundamental properties of the algorithm.

Properties of a Quality Algorithm

  • Independent: Algorithms are not designed for a single programming language. All the instruction should be step by step direction so that it ensures to implement into code in any language that makes it independent.
  • Definiteness: Each step must be clear and unambiguous.
  • Input: The algorithm should be designed as optimized as possible based on the data input.
  • Output: should be very effective and as desired after putting input.
  • Correctness: The output should be correct and as desired.
  • Finiteness: The algorithm must be finished after some finite time or required steps.

Tutorial Prerequisites

An algorithm is a theoretical concept for implementing a problem visually that represent step by step instructions to solve a problem very efficiently. But to apply the concept of algorithms we need some staff. In this tutorial, we will use C as a programming language and data structure concept for implementing algorithms in Data Structure.

So before proceeding this tutorial, make sure you have enough understanding on:

Tutorial Outcome

After completing this tutorial you will be an intermediate level of algorithm expertise that will help to take you to the advanced level of algorithm and data structure expertise.

Posted in