Design Methods: Algorithm, Flowchart, and Pseudocode
1. Algorithm
Definition:
An algorithm is a step-by-step procedure or set of rules to solve a specific problem.
Example - Algorithm to find the largest of two numbers:
Step 1: Start
Step 2: Input number A and number B
Step 3: If A > B, then print A is larger
Step 4: Else, print B is larger
Step 5: Stop
2. Flowchart
Definition:
A flowchart is a visual diagram that represents the sequence of steps in a process using symbols.
Flowchart Symbols:
- Terminator: Start/End
- Process: Action or instruction
- Decision: Yes/No or True/False condition
- Arrows: Show flow direction
Example - Flowchart for finding the largest of two numbers:
[Start]
[Input A, B]
[A > B ?]
Design Methods: Algorithm, Flowchart, and Pseudocode
/ \
Yes No
/ \
[A is >] [B is >]
\ /
[End]
3. Pseudocode
Definition:
Pseudocode is a way of writing algorithms in plain English mixed with programming structure - not actual code, but easy
to convert into one.
Example - Pseudocode for largest of two numbers:
Start
Input A, B
If A > B then
Display "A is greater"
Else
Display "B is greater"
End
Comparison Table
Design Method | Purpose | Format | Best For
--------------|----------------------|----------------|--------------------------
Algorithm | Logical solution | Written steps | Planning logic clearly
Flowchart | Visualizing process | Diagram | Presenting or teaching logic
Pseudocode | Bridging logic & code| Structured text| Preparing to code