IB MYP 4-5 Maths- Algorithms - Study Notes - New Syllabus
IB MYP 4-5 Maths- Algorithms – Study Notes
Standard
- Algorithms
Algorithms
Algorithms
An algorithm is a finite set of clear, well-defined instructions designed to solve a problem or perform a task. Algorithms are fundamental in mathematics and computer science because they provide a step-by-step method to achieve a result.
Characteristics of an Algorithm:
- Definiteness: Each step must be clear and unambiguous.
- Finiteness: It must finish after a finite number of steps.
- Input: It should accept zero or more inputs.
- Output: It should produce at least one output.
- Effectiveness: Each step must be basic and executable.
Represent Algorithms:
- Pseudocode: Uses structured English-like statements.
- Flowchart: Diagram using standard symbols for processes, decisions, and flow.
- Natural Language: A written step-by-step explanation.
Common Algorithm Examples in Mathematics:
- Finding the HCF (Greatest Common Divisor) – Euclidean Algorithm
- Finding the LCM (Least Common Multiple)
- Sorting numbers (Bubble sort, Selection sort)
- Searching for a number in a list (Linear search, Binary search)
Steps to Write an Algorithm:
- Understand the problem clearly.
- Define the input and output.
- Write the steps in a logical order.
- Check if the algorithm covers all possible cases.
- Test the algorithm with examples.
Example :
Algorithm in Pseudocode (Find the Average of 5 Numbers)
▶️ Answer/Explanation
Pseudocode:
START
SET sum = 0
FOR i = 1 TO 5
READ number
sum = sum + number
NEXT i
average = sum / 5
PRINT average
END
Explanation: This algorithm adds 5 numbers and divides by 5 to find the average.
Example :
Flowchart for Finding Maximum of Two Numbers
Steps: Input A and B → Compare → Output the greater number.
▶️ Answer/Explanation
Flowchart Symbols:
- Oval: Start/End
- Parallelogram: Input/Output
- Diamond: Decision
Steps:
- Start
- Input A and B
- If A > B, print A else print B
- End