About Me

Hello there! Before talking about qualifications and professional abilities, I would like to introduce myself. I am a Yuvraj Basnet and professional software developer and have been working in this field for 3 long years. I have finished my graduation from The University of Delhi on Computer Science Engineering I considered myself a reasonably experienced programmer with a particular interest in the human side of software development, computers are fascinating machine, but they're mostly reflection of the people using them. In the art of software development, studying code isn't enough; you have to study the people behind the software, too.


In this tutorial, we will learn about the Algorithm which is used to create a efficient or a readable programs in C language.


What is Algorithm?
Algorithm is a step-by-step procedure, which defines a set of instructions to be executed in a certain order to get the desired output. Algorithms are generally created independent of underlying languages, i.e. an algorithm can be implemented in more than one programming language.
Algorithm is always written in a simple English language.

Characteristics of an Algorithm

1. Unambiguous− Algorithm should be clear and unambiguous. Each of its steps (or phases), and their inputs/outputs should be clear and must lead to only one meaning.

2. Fineness- An algorithm should terminate infinite number of steps and each step must finish in finite amount of time. 

3. Input- An Algorithm should have 0 or more well-defined inputs.

4. Output- An algorithm should have 1 or more well-defined outputs, and should match the desired output

5.Independent− An algorithm should have step-by-step directions, which should be independent of any programming code.

From the data structure point of view, following are some important categories of algorithms −
  • Search − Algorithm to search an item in a data structure.
  • Sort − Algorithm to sort items in a certain order.
  • Insert − Algorithm to insert item in a data structure.
  • Update − Algorithm to update an existing item in a data structure.
  • Delete − Algorithm to delete an existing item from a data structure.


Let us try to learn algorithm-writing by using an example.
Problem − Design an algorithm to multiply two numbers and display the result.
Step 1 − START
Step 2 − declare three integers ab & c
Step 3 − define values of a & b
Step 4 − add values of a & b
Step 5 − store output of step 4 to c
Step 6 − print c
Step 7 − STOP
Algorithms tell the programmers how to code the program. the algorithm can be written as −
Step 2 − get values of a & b
Step 3 − c ← a * b
Step 4 − display c
Step 5 − STOP

Post a Comment