an algorithm

an algorithm - an algorithm is a type of effective method...

This preview shows pages 1–3. Sign up to view the full content.

an algorithm is a type of effective method in which a definite list of well-defined instructions for completing a task; that given an initial state, will proceed through a well- defined series of successive states, eventually terminating in an end-state 'algorithm'---> means writing down the basic steps in which we need to solve the problem. ..given it is independent of any programming language. ..that means. ... say for eg. . et us take an example. ..suppose u r given a problem to input two numbers, find the sum of those two numbers and print the result on the screen. ... Test case defines an unique test condition to validate the correctness and completeness of a functionality. if we are to find the largest of three numbers and suppose user is entetring 3 numbers which are equal. . think. .. then we have to consider that case. . similar is the case for all examples. . we have to consider all those cases. .. so in the same algorithm we need to incorporate all possible cases. .. so ur frnd is rite. . the algorithm can get bigger with the questions complexity http://users.evtek.fi/~jaanah/IntroC/DBeech/3gl_step.htm Step-Form algorithms - the simplest form of algorithm and: How to use Trace Tables After completing this lesson you should be able to: 1. apply a strategy to the process of designing a step-form algorithm 2. construct a trace table This is quite a large lesson since we get down to some of the details of algorithm design and introduce the trace table. You should pay close attention to this lesson since some key topics are revealed by 'discovery', especially in the trace table topic.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Exercise 1 - a first design exercise Exercise 2 - a second and more detailed design exercise Exercise 3 - building a trace table When you have finished the lesson you might like to attempt these questions to assess how much you have learned. Return to the index Go to the next lesson Return to the previous lesson Step-form algorithms This form of algorithm is the simplest and consists of a sequence of numbered steps or points. It is the easiest to learn at first since it is rather like a "to-do" list however once you have mastered other ways of stating algorithms you are unlikely to continue using this form. You have already used this form in a previous lesson - the tea-making algorithm. Here is another example: First of all the problem to solve is: Design a program which counts all the vowels on a given page of text. Remember in the second lesson we came up with a strategy for designing algorithms so use this as a starting point: Step 1: Investigation step 1. Identify the processes 2. Identify the major decisions 3. Identify the loops 4. Identify the variables Step 2: Preliminary algorithm step 1. Devise a "high level" algorithm 2. Step through the algorithm. Does this "walk-through" reveal any major problems? If it does then correct the problems.
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/06/2010 for the course UBIT 411 taught by Professor Saleemelahi during the Spring '10 term at University of Karachi.

Page1 / 8

an algorithm - an algorithm is a type of effective method...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online