C, Programmimg Languages

What is an Algorithm??

Definition-

An Algorithm is a finite sequence of instructions, each of which has a clear meaning and can be performed with a finite amount of effort in a finite length of time.

History-

  • The word Algorithm from the name of the 9th century Persian Muslim mathematician Abu Abdullah Muhammad ibn Musa Al-Khwarizmi.
  • Algorism originally referred only to the rules of performing arithmetic using Hindu-Arabic numerals but evolved via European Latin translation of Al-Khwarizmi’s name into algorithm in 18th century. The use of the word evolved to include all definite procedures for solving problems or performing task.

Features of a good Algorithm

  • Each and every instruction should be precise and unambiguous.
  • Each instruction should be such that it can be performed in a finite time.
  • One or more instructions should not be repeated infinitely. This ensures that the algorithm will ultimately terminate.
  • After performing the instructions i.e. after the algorithm terminates, the desired results must be obtained.

Examples-

  1.  Write an algorithm to find the area of a circle.

    Solution:

    Step 1. Start.

    Step 2. Enter the Radius, r.

    Step 3.Read the radius, r.

    Step 4. Area = π * r * r.

    Step 5. Print Area of a circle.

    Step 6. Stop.

  2.  Write an algorithm to find the sum of two given numbers.Solution:

    Step 1. Start.

    Step 2. Read the first number, A.

    Step 3. Read the second number, B.

    Step 4. Sum = A + B.

    Step 5. Print Sum.

    Step 6. Stop.

 

You can also Watch video on Youtube

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s