OneStopGate.Com
OnestopGate   OnestopGate

  JOIN GATE GROUP, Looking for GATE Preparation Materials? Join & Get GATE Preparation Materials now!, JOIN GATE GROUP
OnestopGate
Home | Overview | Syllabus | Tutorials | FAQs | Downloads | Advertise | Contact Us | Forum
OneStopGate

GATE Overview
  arrow to indicate  Overview
  arrow to indicate  GATE Eligibility
  arrow to indicate  Structure Of GATE
  arrow to indicate  GATE Coaching       Centers
  arrow to indicate  Colleges Providing M.Tech/M.E.
  arrow to indicate  GATE Score
  arrow to indicate  GATE Results
  arrow to indicate  PG with Scholarships
  arrow to indicate  Article On GATE
  arrow to indicate  GATE Forum

GATE 2009 Exclusive
  arrow to indicate  GATE 2009 Syllabus
  arrow to indicate  GATE Organizing Institute
  arrow to indicate  Important Dates
  arrow to indicate  How to Apply
  arrow to indicate  Discipline Codes

GATE Syllabus
  arrow to indicate  Aerospace Engg..
  arrow to indicate  Agricultural Engg..
  arrow to indicate  Architecture and Planning
  arrow to indicate  Chemical Engg..
  arrow to indicate  Chemistry
  arrow to indicate  Civil Engg..
  arrow to indicate  Computer Science / IT
  arrow to indicate  Electronics & Communication Engg..
  arrow to indicate  Electrical Engg..
  arrow to indicate  Engineering Sciences
  arrow to indicate  Geology and Geophysics
  arrow to indicate  Instrumentation Engineering
  arrow to indicate  Life Sciences
  arrow to indicate  Mathematics
  arrow to indicate  Mechanical Engg..
  arrow to indicate  Metallurgical Engg..
  arrow to indicate  Mining Engg..
  arrow to indicate  Physics
  arrow to indicate  Production & Industrial Engg..
  arrow to indicate  Pharmaceutical Sciences
  arrow to indicate  Textile Engineering and Fibre Science

GATE Study Material
  arrow to indicate  Aerospace Engg..
  arrow to indicate  Agricultural Engg..
  arrow to indicate  Chemical Engg..
  arrow to indicate  Chemistry
  arrow to indicate  Civil Engg..
  arrow to indicate  Computer Science /       IT
  arrow to indicate  Electronics &       Communication Engg..
  arrow to indicate  Electrical Engg..
  arrow to indicate  Engineering Sciences
  arrow to indicate  Instrumentation       Engg..
  arrow to indicate  Life Sciences
  arrow to indicate  Mathematics
  arrow to indicate  Mechanical Engg..
  arrow to indicate  Physics
  arrow to indicate  Pharmaceutical       Sciences
  arrow to indicate  Textile Engineering        and Fibre Science

GATE Preparation
  arrow to indicate  GATE Pattern
  arrow to indicate  GATE Tips N Tricks
  arrow to indicate  Compare Evaluation
  arrow to indicate  Sample Papers
  arrow to indicate  GATE Downloads
  arrow to indicate  Experts View

CEED 2009
  arrow to indicate  CEED Exams
  arrow to indicate  Eligibility
  arrow to indicate  Application Forms
  arrow to indicate  Important Dates
  arrow to indicate  Contact Address
  arrow to indicate  Examination Centres
  arrow to indicate  CEED Sample Papers

Discuss GATE
  arrow to indicate  GATE Forum
  arrow to indicate  Exam Cities
  arrow to indicate  Contact Details
  arrow to indicate  Bank Details

Miscellaneous
  arrow to indicate  GATE FAQs
  arrow to indicate  Advertisment
  arrow to indicate  Contact Us

Home » Gate Study Material » Computer Science » ADA

Analysis,Design And Algorithm

Looking for GATE Preparation Material? Join & Get here now!
Discussion Center

Discuss/
Query

Papers/
Syllabus

Feedback/
Suggestion

Yahoo
Groups

Sirfdosti
Groups

Contact
Us
  Print
<<Previous Next>>

Charaterstic Of Algorithm

Let us try to present the scenario of a man brushing his own teeth(natural denture) as an algorithm as follows.

Step 1. Take the brush

Step 2. Apply the paste

Step 3. Start brushing

Step 4. Rinse

Step 5. Wash

Step 6. Stop

If one goes through these 6 steps without being aware of the statement of the problem, he could possibly feel that this is the algorithm for cleaning a toilet. This is because of several ambiguities while comprehending every step. The step 1 may imply tooth brush, paint brush, toilet brush etc. Such an ambiguity doesn’t an instruction an algorithmic step. Thus every step should be made unambiguous. An unambiguous step is called definite instruction. Even if the step 2 is rewritten as apply the tooth paste, to eliminate ambiguities yet the conflicts such as, where to apply the tooth paste and where is the source of the tooth paste, need to be resolved. Hence, the act of applying the toothpaste is not mentioned. Although unambiguous, such unrealizable steps can’t be included as algorithmic instruction as they are not effective.

The definiteness and effectiveness of an instruction implies the successful termination of that instruction. However the above two may not be sufficient to guarantee the termination of the algorithm. Therefore, while designing an algorithm care should be taken to provide a proper termination for algorithm.

Thus, every algorithm should have the following five characteristic feature

    1. Input
    2. Output
    3. Definiteness
    4. Effectiveness
    5. Termination

Therefore, an algorithm can be defined as a sequence of definite and effective instructions, which terminates with the production of correct output from the given input.

In other words, viewed little more formally, an algorithm is a step by step formalization of a mapping function to map input set onto an output set.

The problem of writing down the correct algorithm for the above problem of brushing the teeth is left to the reader.

For the purpose of clarity in understanding, let us consider the following examples.

Example 1:

Problem : finding the largest value among n>=1 numbers.

Input : the value of n and n numbers

Output : the largest value

Steps :

    1. Let the value of the first be the largest value denoted by BIG
    2. Let R denote the number of remaining numbers. R=n-1
    3. If R != 0 then it is implied that the list is still not exhausted. Therefore look the next number called NEW.
    4. Now R becomes R-1
    5. If NEW is greater than BIG then replace BIG by the value of NEW
    6. Repeat steps 3 to 5 until R becomes zero.
    7. Print BIG
    8. Stop

End of algorithm

Example 2: quadratic equation

Example 3: listing all prime numbers between two limits n1 and n2.

 

1.2.1 Algorithmic Notations

In this section we present the pseudocode that we use through out the book to describe algorithms. The pseudo code used resembles PASCAL and C language control structures. Hence, it is expected that the reader be aware of PASCAL/C. Even otherwise atleast now it is required that the reader should know preferably C to practically test the algorithm in this course work.

However, for the sake of completion we present the commonly employed control constructs present in the algorithms.

  1. A conditional statement has the following form
  2. If < condition> then

    Block 1

    Else

    Block 2

    If end.

    This pseudocode executes block1 if the condition is true otherwise block2 is executed.

  3. The two types of loop structures are counter based and conditional based and they are as follows
    • For variable = value1 to value2 do
Block

For end

Here the block is executed for all the values of the variable from value 1 to value 2.

    • There are two types of conditional looping, while type and repeat type.

While (condition) do

Block

While end.

Here block gets executed as long as the condition is true.

    • Repeat
Block

Until<condition>

Here block is executed as long as condition is false. It may be observed that the block is executed atleast once in repeat type.

Exercise 1;

Devise the algorithm for the following and verify whether they satisfy all the features.

  1. An algorithm that inputs three numbers and outputs them in ascending order.
  2. To test whether the three numbers represent the sides of a right angle triangle.
  3. To test whether a given point p(x,y) lies on x-axis or y-axis or in I/II/III/IV quadrant.
  4. To compute the area of a circle of a given circumference
  5. To locate a specific word in a dictionary.


<<Previous Next>>

MEMBERS LOGIN
  
EmailId:
Password:

  Forgot Password?
 New User? Register!
A D V E R T I S E M E N T
INTERVIEW EBOOK
Get 9,000+ Interview Questions & Answers in an eBook. Interview Question & Answer Guide
  • 9,000+ Interview Questions
  • All Questions Answered
  • 5 FREE Bonuses
  • Free Upgrades
START YOUR WEBSITE
India's Best Web Hosting Company
GATE RESOURCES
 
  • Gate Books
  • Training Institutes
  • Gate FAQs
  • GATE Exam, Gate 2009, Gate Papers, Gate Preparation & Related Pages


    GATE Overview | GATE Eligibility | Structure Of GATE | GATE Training Institutes | Colleges Providing M.Tech/M.E. | GATE Score | GATE Results | PG with Scholarships | Article On GATE | GATE Forum | GATE 2009 Exclusive | GATE 2009 Syllabus | GATE Organizing Institute | Important Dates for GATE Exam | How to Apply for GATE | Discipline / Branch Codes | GATE Syllabus for Aerospace Engineering | GATE Syllabus for Agricultural Engineering | GATE Syllabus for Architecture and Planning | GATE Syllabus for Chemical Engineering | GATE Syllabus for Chemistry | GATE Syllabus for Civil Engineering | GATE Syllabus for Computer Science / IT | GATE Syllabus for Electronics and Communication Engineering | GATE Syllabus for Engineering Sciences | GATE Syllabus for Geology and Geophysics | GATE Syllabus for Instrumentation Engineering | GATE Syllabus for Life Sciences | GATE Syllabus for Mathematics | GATE Syllabus for Mechanical Engineering | GATE Syllabus for Metallurgical Engineering | GATE Syllabus for Mining Engineering | GATE Syllabus for Physics | GATE Syllabus for Production and Industrial Engineering | GATE Syllabus for Pharmaceutical Sciences | GATE Syllabus for Textile Engineering and Fibre Science | GATE Preparation | GATE Pattern | GATE Tips & Tricks | GATE Compare Evaluation | GATE Sample Papers | GATE Downloads | Experts View on GATE | CEED 2009 | CEED 2009 Exam | Eligibility for CEED Exam | Application forms of CEED Exam | Important Dates of CEED Exam | Contact Address for CEED Exam | CEED Examination Centres | CEED Sample Papers | Discuss GATE | GATE Forum of OneStopGATE.com | GATE Exam Cities | Contact Details for GATE | Bank Details for GATE | GATE Miscellaneous Info | GATE FAQs | Advertisement on GATE | Contact Us on OneStopGATE |
    Copyright © 2009. One Stop Gate.com. All rights reserved Privacy Policies | About Us
    Our Portals : Academic Tutorials | Best eBooksworld | Beyond Stats | City Details | Interview Questions | Discussions World | Excellent Mobiles | Free Bangalore | Give Me The Code | Gog Logo | Indian Free Ads | Jobs Assist | New Interview Questions | One Stop FAQs | One Stop GATE | One Stop GRE | One Stop IAS | One Stop MBA | One Stop SAP | One Stop Testing | Quick2Host | Quick2Host Mirror | Quick Site Kit | Sirf Dosti | Source Codes World | Tasty Food | Tech Archive | Testing Interview Questions | Tests World | The Galz | Top Masala | Vyom | Vyom eBooks | Vyom International | Vyom Links | Vyoms | Vyom World
    C Interview Questions | C++ Interview Questions | Send Free SMS | Placement Papers | SMS Jokes