Top down Step wise Refinement
- Start with the initial problem statement (Abstract form)
- Break the initial statement into few general steps
- Take each "step", and break it further into more detailed steps
- Continue the refinement process until you get a pretty specific, pseudo code which can be easily implemented
- Write a Pseudo code of an algorithm outputs minimum of two numbers given by the user using Top down Step wise Refinement method.
Program Control Structures
- Specify the next statement to be executed
- Sequential Structures
- Selection Structures
- IF statement -Single selection
- IF ELSE statement -Double selection
- Nested IF ELSE
- Switch Statement
Repetition Structures
- Repeat a given statement , while some condition remains true
- Counter Controlled repetition
- Uses a variable counter to control the number of iterations
- Definite repetition : the number of iterations is known before the loop begin execution
- Sentinel Controlled repetition
- Uses a sentinel value (a signal value, a dummy value or a flag value) to control the number of iterations
- Indefinite repetition : the number of iterations is not known in advance how many times the loop will be executed
- Test the terminating condition at the beginning of the loop
- Loop body may not be executed at all
- Write a program to print the all the integer numbers from 10 to 1
For Structure (For Loop)
- Used when the number of iterations is known in advance
- Test the terminating condition at the end of the loop
- The statement of block of statements in the loop will be executed at least once
- Loop which never end
- A while loop without increment or decrement statement
- A while loop with a terminating condition which always evaluates as TRUE
No comments:
Post a Comment