Notations for Algorithm design

0 views - 1 minute readEdit this post

I rely on your support to keep this website running. If you find the content valuable, please consider making a small donation. whether it’s ₹25/$1 or ₹500/$5.

Donate

Secured by Stripe

Notation for Algorithm design

  1. Name of algorithm:

    • Every algorithm is given an identifying name written capital letters.
    • Example:
      • ARRAY_SEARCH(option1, option2)
  2. Steps:

    • The actual algorithm is made up of a number of steps each starting with a phrase enclosed in square brackets which gives a description of that step.
    • Example:
      • Step 1 [Description of step] Instruction.
  3. Assignment statement:

    • It is indicated by placing an arrow between the right-hand side and left-hand side of the statement and the variable receiving the value.
    • Example:
      • A <- 10
  4. If statement:

    • This helps to add conditions in the algorithm.
    • Example:
      • if(condition)then thiselse
  5. Case statement:

    • The case statement is used for multiple choice type solution.
  6. Repeat statement:

    • It is used to create loops in the algorithm.
      • While loop
      • For loop
    • Example:
      • Repeat while (condition)
  7. Goto statement:

    • This goto statement causes unconditional transfer of control to the step referenced.
  8. exit statement:

    • It is used to terminate an algorithm.

Example of an Algorithm

SUM OF TWO NUMBERS

Step 1: [Initialization]Take two inputs numbers from the user: a,b

Step 2: [Compute Sum]Sum = a+b

Step 3: [Print result] Print Sum

step 4: [Finish]

Did you enjoyed the post?

Twitter (x)