Algorithm Design and Problem Solving – Detailed Notes
7.1 Program Development Life Cycle
The development of a program follows five main stages:
• Analysis: Clearly define the problem, identify inputs, outputs, processes, and
constraints.
• Design: Plan the solution using structure charts, flowcharts, or pseudocode.
• Coding: Translate the design into a programming language while following coding
standards.
• Testing: Check program correctness using normal, boundary, and erroneous data.
• Maintenance: Update the program post-deployment, fix bugs, and add new
features.
7.2 Computer Systems, Sub-systems, and Decomposition
A computer system consists of hardware, software, data, people, and communications. Large
systems can be broken into smaller subsystems.
Decomposition: Breaking a large problem into smaller sub-problems, each of which
can be solved independently.
Example: Alarm App → (1) Set Alarm Time, (2) Compare with Current Time, (3) Sound
Alarm
7.2.3 Methods to Design & Construct Solutions
Structure Diagrams: Show top-down breakdown of a system into sub-modules.
Flowcharts: Visual representation of algorithms using symbols.
• Terminator (Start/End) – Oval
• Process – Rectangle
• Decision – Diamond
• Input/Output – Parallelogram
• Flow lines – Arrows showing sequence
Pseudocode
Text-based way of representing algorithms, close to programming languages but easier to read.
• Assignment: Total ← Value1 + Value2
• Input: INPUT Name
• Output: OUTPUT "Hello" & Name
Conditional Statements
IF…THEN…ELSE
CASE…OF…OTHERWISE (used for multiple conditions)
Iteration (Loops)
• REPEAT…UNTIL: Post-condition loop, executes at least once.
• WHILE…DO…ENDWHILE: Pre-condition loop, executes while condition is true.
• FOR…TO…NEXT: Fixed number of repetitions.
Input/Output in Algorithms
INPUT – user enters values
OUTPUT – program displays values