7.1 Algorithm design and problem-solving

Show All Section Notes

Computational Thinking

1. What is an Algorithm?

An Algorithm is a set of step-by-step instructions used to solve a specific problem or complete a task.

Input ➔ Process ➔ Output

An algorithm must be finite (it must end), unambiguous (clear instructions), and effective (it must actually solve the problem).

2. Key Concepts in Computational Thinking

Abstraction

The process of filtering out unnecessary details and focusing only on the information needed to solve the problem.

Example: A map of a subway doesn't show buildings or trees, only the stations and lines.

Decomposition

Breaking down a complex problem into smaller, more manageable sub-problems that are easier to solve individually.

Example: Breaking the task of "Making a Cake" into "Buying ingredients," "Mixing," and "Baking."

3. The Program Development Life Cycle (PDLC)

Developing software is a structured process. Each stage depends on the completion of the previous one.

Stages of the PDLC
1. Analysis
Understanding the problem. Outcome: Requirements Specification (Input, Process, Output requirements).
2. Design
Planning how the software will look and work. Outcome: Flowcharts, Pseudocode, and Structure Diagrams.
3. Coding
Writing the actual program using a high-level language. Outcome: Source Code.
4. Testing
Running the program to find and fix errors. Outcome: Test Report and Bug-free software.
5. Maintenance
Updating the program over time. Outcome: Updated software and patches.

4. Testing: Ensuring Accuracy

During the testing stage, we use different types of data to see if the program breaks. Here is the Testing Toolkit at a glance:

  • Normal Data: Expected data that should be accepted (e.g., age 25).
  • Abnormal/Erroneous Data: Data of the wrong type or outside limits that should be rejected (e.g., "twenty" or -5).
  • Extreme Data: The largest and smallest values at the very edges of the valid range (e.g., 1 and 100).
  • Boundary Data: Pairs of values at the limit: one just valid (e.g., 100) and one just invalid (e.g., 101).
⚠️ Exam Tip: When asked for the difference between Extreme and Boundary data: Extreme data is valid; Boundary data includes one valid and one invalid value.