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 welldefined
instructions for completing a task; that given an initial state, will proceed through a well
defined series of successive states, eventually terminating in an endstate
'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
StepForm 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 stepform 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
Stepform 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 "todo" 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 teamaking 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 "walkthrough" 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.
 Spring '10
 SaleemElahi

Click to edit the document details