Review the key concepts, formulae, and examples before starting your quiz.
🔑Concepts
An algorithm is a finite, step-by-step procedure to solve a specific mathematical problem, such as solving a linear equation like .
A flowchart is a visual representation of an algorithm using standard symbols: Oval (Start/End), Parallelogram (Input/Output), Rectangle (Process/Calculation), and Diamond (Decision/Condition).
Variables in algorithms act as containers for values. Assignment is often represented as , which means 'store the value in variable '.
Selection (Decision) structures allow the algorithm to branch based on a condition, such as comparing two values: or .
Iteration (Looping) is the process of repeating a sequence of steps. For example, to find the sum of the first integers, an algorithm might repeat the operation for to .
Dry Running is the process of manually tracing the steps of an algorithm with specific input values to verify its correctness.
📐Formulae
💡Examples
Problem 1:
Create an algorithm to solve for in the linear equation , where .
Solution:
- Start. 2. Input values for , , and . 3. Calculate . 4. Calculate . 5. Output . 6. End.
Explanation:
The algorithm follows the algebraic steps of isolation: first subtract from both sides, then divide by to find .
Problem 2:
Design a flowchart logic to determine if a given integer is even or odd.
Solution:
- Start. 2. Input . 3. If , then Output 'Even'. 4. Else, Output 'Odd'. 5. End.
Explanation:
The modulo operator returns the remainder when is divided by . If the remainder is , the number is even.
Problem 3:
Trace the values of and in an algorithm to find the sum of the first natural numbers where and goes from to .
Solution:
Explanation:
The loop adds the current value of the counter to the running total in each iteration until exceeds .