Anonymous

Why Do We Need To Study Algorithm?

2 Answers

Florio Potter Profile
Florio Potter answered

You can say algorithm is a logical map of your program. Now consider you are given a problem and you have to create a program to solve it. Lets take an example.
ex. Create a program to determine whether input number is even or odd.
Now if you directly start writing the program code, you will find it very difficult to complete the program. But if you create steps and procedure map (algorithm) on the paper, you will find it very easy to write the program. Here is the algorithm for above problem. Meaning of each step is also given in bracket for better understanding.

  1. start (include header files or other resources which your program may need)
  2. input number A (write the coding part which takes number input from keyboard)
  3. perform operation B = 'A % 2' (perform modulo operation by 2 to check whether input no. Is perfectly divisible by 2)
  4. if B=0
    • display "input number is even"
    • Goto step 6
  5. else
    • display "input number is odd"
    • goto step 6
  6. End (terminate the program)


As above example is one of the simplest examples, it is not much difficult to write the program directly. But if the problem is bigger and requires large number of logic steps and loops it is always advised to create the algorithm first because it makes you simpler to write the program.

For detailed information get help at CodeAvail- Online Computer Science Assignment
help

Anonymous Profile
Anonymous answered
An algorithm gives a quick review to a problem that attempts to arrive at solution easily,in sequential steps.

Answer Question

Anonymous