Javatpoint Logo
Javatpoint Logo

DAA Algorithm

The word algorithm has been derived from the Persian author's name, Abu Ja 'far Mohammed ibn Musa al Khowarizmi (c. 825 A.D.), who has written a textbook on Mathematics. The word is taken based on providing a special significance in computer science. The algorithm is understood as a method that can be utilized by the computer as when required to provide solutions to a particular problem.

An algorithm can be defined as a finite set of steps, which has to be followed while carrying out a particular problem. It is nothing but a process of executing actions step by step.

An algorithm is a distinct computational procedure that takes input as a set of values and results in the output as a set of values by solving the problem. More precisely, an algorithm is correct, if, for each input instance, it gets the correct output and gets terminated.

An algorithm unravels the computational problems to output the desired result. An algorithm can be described by incorporating a natural language such as English, Computer language, or a hardware language.

Characteristics of Algorithms

  • Input: It should externally supply zero or more quantities.
  • Output: It results in at least one quantity.
  • Definiteness: Each instruction should be clear and ambiguous.
  • Finiteness: An algorithm should terminate after executing a finite number of steps.
  • Effectiveness: Every instruction should be fundamental to be carried out, in principle, by a person using only pen and paper.
  • Feasible: It must be feasible enough to produce each instruction.
  • Flexibility: It must be flexible enough to carry out desired changes with no efforts.
  • Efficient: The term efficiency is measured in terms of time and space required by an algorithm to implement. Thus, an algorithm must ensure that it takes little time and less memory space meeting the acceptable limit of development time.
  • Independent: An algorithm must be language independent, which means that it should mainly focus on the input and the procedure required to derive the output instead of depending upon the language.

Advantages of an Algorithm

  • Effective Communication: Since it is written in a natural language like English, it becomes easy to understand the step-by-step delineation of a solution to any particular problem.
  • Easy Debugging: A well-designed algorithm facilitates easy debugging to detect the logical errors that occurred inside the program.
  • Easy and Efficient Coding: An algorithm is nothing but a blueprint of a program that helps develop a program.
  • Independent of Programming Language: Since it is a language-independent, it can be easily coded by incorporating any high-level language.

Disadvantages of an Algorithm

  • Developing algorithms for complex problems would be time-consuming and difficult to understand.
  • It is a challenging task to understand complex logic through algorithms.


Pseudocode refers to an informal high-level description of the operating principle of a computer program or other algorithm. It uses structural conventions of a standard programming language intended for human reading rather than the machine reading.

Advantages of Pseudocode

  • Since it is similar to a programming language, it can be quickly transformed into the actual programming language than a flowchart.
  • The layman can easily understand it.
  • Easily modifiable as compared to the flowcharts.
  • Its implementation is beneficial for structured, designed elements.
  • It can easily detect an error before transforming it into a code.

Disadvantages of Pseudocode

  • Since it does not incorporate any standardized style or format, it can vary from one company to another.
  • Error possibility is higher while transforming into a code.
  • It may require a tool for extracting out the Pseudocode and facilitate drawing flowcharts.
  • It does not depict the design.

Difference between Algorithm and the Pseudocode

An algorithm is simply a problem-solving process, which is used not only in computer science to write a program but also in our day to day life. It is nothing but a series of instructions to solve a problem or get to the problem's solution. It not only helps in simplifying the problem but also to have a better understanding of it.

However, Pseudocode is a way of writing an algorithm. Programmers can use informal, simple language to write pseudocode without following any strict syntax. It encompasses semi-mathematical statements.

Problem: Suppose there are 60 students in the class. How will you calculate the number of absentees in the class?

Pseudo Approach:

  1. Initialize a variable called as Count to zero, absent to zero, total to 60
  2. FOR EACH Student PRESENT DO the following:
    Increase the Count by One
  3. Then Subtract Count from total and store the result in absent
  4. Display the number of absent students

Algorithmic Approach:

  1. Count <- 0, absent <- 0, total <- 60
  2. REPEAT till all students counted
    Count <- Count + 1
  3. absent <- total - Count
  4. Print "Number absent is:" , absent

Next TopicNeed of Algorithm

Youtube For Videos Join Our Youtube Channel: Join Now

Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA