Part 1 — Introduction: simple and complex problems (printed pp 54–56)
The chapter opens with its Student Learning Outcomes (printed p 54): by the end of the unit, students will be able to define and identify simple and complex problems, create algorithms for them, discuss the scope and limitations of complex algorithms, write pseudocode, use constants and variables, apply If / If-Else / If-Elif-Else conditions, repeat and forever loops and nesting, compare the performance of two algorithms, select the best solution, and explain problems that cannot be solved computationally. The full list of 14 outcomes is given in the Teacher's Guide tab.
3.1 Introduction to Unit. In today's world we face various simple and complex problems. It is very important to solve these problems quickly and effectively. Algorithms play a key role in solving various tasks. These tasks can range from simple ones, such as making a sandwich, to complex ones, such as developing algorithms in artificial intelligence. In this unit we learn the approach of algorithmic thinking to solve complex problems in a more systematic way, learn problem-solving strategies for finding the most efficient algorithms, and learn the core concept of nesting in algorithms.
3.2 Simple and Complex Problems. A problem is something that needs to be solved or overcome. Problems can either be simple or complex. Simple problems have fewer steps and can often be solved in a straightforward manner; the process is clear, and the path from the problem to the solution is usually direct. Example: solving a basic maths equation like 3 + 5 = ? Another of the book's examples (Figure 3.1(a)) is setting an alarm to wake up in the morning — you simply set the alarm on your phone or clock.
A complex problem requires multiple steps, often involving layers of decision-making or additional sub-problems that need to be solved first; the solution may not be immediately obvious. Example: planning a road trip across multiple cities while optimising for time, distance and fuel costs. The book's Figure 3.1(b) example is throwing a birthday party for 10 friends: you need to plan the guest list, choose a location, and decide on snacks, games and activities — the solution requires decision-making, managing different preferences, budgeting and time.
📚 Book Vocabulary — Words in this part
Simple problem — Problems which are easy to understand, analyze and solve. (Book's Summary, printed p 87.) ⭐Book word
Complex problem — Problems which take more time and effort to solve because they involve multiple parts or steps. (Book's Summary, printed p 87.) ⭐Book word
🌱 Extra Help Words — Words in this part
Input — The data given to an algorithm so that it can work — for example, the two numbers in an addition algorithm.
Part 2 — The problem-solving approach and computational thinking (printed pp 57–61)
3.3 Problem Solving Approach. Problem-solving refers to the process of finding solutions to problems that we come across in everyday life; it states that we always have to find the necessary steps to be taken in a sequence to complete a task. The book explains it with two examples. Example-1 — making instant noodles (a real-world problem): 1. Pour the water into the pot. 2. Bring it to a boil. 3. Add the noodles to the pot. 4. Cook the noodles. 5. Add the seasoning while cooking the noodles. 6. Pour it into a bowl. Example-2 — finding the average of three numbers (a computer-related problem): 1. Input three numbers. 2. Perform addition of the three numbers. 3. Find the average. 4. Display the average.
3.4 Computational Thinking. Computational thinking solves a problem in four steps. Step-1: Decomposition — breaking the problem into smaller, more manageable parts (the book illustrates this with breaking a LEGO-building task into pieces). Step-2: Pattern recognition — looking for patterns, trends and similarities inside the problem, so that solutions used before can be recognised and reused. Step-3: Abstraction — focusing only on the important details and ignoring the irrelevant information. Step-4: Algorithm — developing a step-by-step solution to the problem. For example, the step-by-step plan that can guide the task of building a LEGO car: 1. Start with the base (chassis). 2. Add the wheels. 3. Attach the body. 4. Add the windows and lights.
Do you know? Computational thinking defines how problems can be solved using computer-based processes and algorithms.
3.4.1 Notations for Creating Algorithm. An algorithm is a well-defined sequence of steps to solve a problem. The basic notations for writing an algorithm are:
- Start: to mark the beginning of an algorithm.
- End: to mark the ending of an algorithm.
- Read/Input: it represents the inputs required for the algorithm.
- Display/Output: it represents the final result of the algorithm.
- Steps/Instructions: the sequence of steps of an algorithm should be in numbered or ordered steps.
- Conditions: it shows the decisions using if, else, or elseif.
- Loops: it indicates the repetition using loop constructs such as repeat and forever loops.
- Assignment: use the equal sign (=) to assign values.
- Comments: these are the optional notes for clarity. Comments are usually written followed by a forward double slash '//'.
The book's worked example — a simple algorithm for adding two numbers:
2. Input: x, y // x and y are variables that shall take numbers from the user
3. Sum = x + y // perform addition of two numbers
4. Output: Sum // Output represent the result of addition
5. End // Used to mark the ending point
📚 Book Vocabulary — Words in this part
Problem-Solving — The process of identifying a problem, developing solutions, and selecting the best one. (Book's Important Points, printed p 90.) ⭐Book word
Computational Thinking — It defines how problems can be solved using computer-based processes and algorithms. (Book's 'Do you know?' box, printed p 61.) ⭐Book word
Decomposition — Step 1 of computational thinking: breaking a problem into smaller, more manageable parts. (Book's §3.4, printed pp 58–59.) ⭐Book word
Pattern Recognition — Identifying patterns, trends, and regularities in data, as well as recognizing similarities within the problem. (Book's wording, printed pp 59–60 and Exercise Q1.) ⭐Book word
Abstraction — Focusing only on the important details while ignoring irrelevant information. (Book's wording, printed p 60 and Exercise Q1.) ⭐Book word
Algorithm — A well-defined sequence of steps to solve a problem. (Book's Important Points, printed p 90.) ⭐Book word
🌱 Extra Help Words — Words in this part
Output — The result an algorithm displays after doing its work — for example, the sum of two numbers.
Part 3 — Creating solutions; scope and limitations (printed pp 62–65)
3.5 Creating Solutions to Problems. A solution can be presented in different forms: structured diagrams, flowcharts, an algorithm, or pseudocode. 3.5.1 Creating Solutions to Simple Problems — the book's algorithm for converting hours into minutes:
1. Start
2. Read: Hours. // How many hours need to be converted
3. Minutes = Hours * 60. // One hour = 60 minutes
4. Output: Minutes.
5. End
3.5.2 Creating Solutions to Complex Problems — the book's worked example is about Rayyan's marbles: Rayyan has 5 bags of 12 marbles (5 × 12 = 60 marbles). He gives 3 bags to his brother (3 × 12 = 36 marbles), so 60 − 36 = 24 marbles remain. He then buys 2 new bags of 10 marbles (2 × 10 = 20), so 24 + 20 = 44 marbles. Rayyan now has 44 marbles. The algorithm for this complex problem is written in general steps: 1. Calculate the initial total number of marbles Rayyan has. 2. Subtract the marbles given to the brother. 3. Add the marbles from the new bags. 4. Display the total number of marbles.
3.5.3 Scope and Limitations of Complex Problems. The scope of a problem defines what we are focusing on in a problem; we may think of scope as setting the boundaries. However, the limitations refer to the things that make it harder to solve the problem; they may also include the things that we cannot change. The book explains with a student trying to balance homework, sports practice and hanging out with friends — a complex problem because it is hard to find the perfect balance, due to: Limited Time (there are only 24 hours in a day, and you also need time to eat and sleep; even with careful planning, there is no guarantee you can fit everything in); Unpredictable Tasks and Events (a homework assignment takes longer than expected, a surprise project is assigned, or a family emergency or illness disturbs your routine); and Changing Priorities (some days you want more sports, other days more school work; your mood and what is important to you can change). In short: simple problems can be solved easily, while the solution of a complex problem is not guaranteed — various unpredictable factors make it difficult to guarantee that you will always have a solution.
Do you know? Scope defines what part of a problem we will focus on in solving a problem. However, limitations define what challenges will make it harder to solve a problem.
📚 Book Vocabulary — Words in this part
Scope — The boundaries or limits that define what a problem includes and what it does not. Scope defines what part of a problem we will focus on in solving it. (Book's Summary and 'Do you know?' box, printed pp 65, 87.) ⭐Book word
Limitations — The things that make it harder to solve a problem — for example limited time, unpredictable tasks and events, and changing priorities. (Book's §3.5.3, printed pp 64–65.) ⭐Book word
🌱 Extra Help Words — Words in this part
Flowchart — A diagram that shows the steps of an algorithm with shapes and arrows; a diamond shape is used for a decision (condition).
Part 4 — Pseudocode and the basics of writing it (printed pp 65–66)
3.6 Pseudocode. A pseudocode is a simple method of showing an algorithm. It is a way to describe problem-solving instructions using any human understandable language. It also serves as a communication option that can help us explain our ideas to other people. Programmers often use pseudocode as an intermediate step in programming, between the initial planning stage and the stage of writing the actual executable code. Do you know? Pseudocode is pronounced by keeping the first character 'P' silent and breaking the remaining word into two parts: "seudo" and "code".
3.6.1 Basics of Writing a Pseudocode. Writing pseudocode allows you to focus on the logic of the solution, without worrying about syntax. There are no set guidelines for writing pseudocode; however, it can be helpful to use simple English words like input, output, if-then-else, for, while, do, etc. The basics are:
- Start with a Clear Objective: a pseudocode must begin with a clear statement of its purpose, to help the readers understand what problem is being solved.
- Sequential Steps: pseudocode should always follow a logical and clear sequence of steps; put the tasks in proper order first, then start writing.
- Use Simple Language: pseudocode should be written using easy-to-understand language.
- Proper Naming Conventions: use variable names which should be meaningful and concise.
- Clear Start and End: start a pseudocode with a "Begin" or "Start" and end it with a "Stop" or "End" to indicate the boundaries of the process.
- Use Indentation for Hierarchy: indentation means to add spaces or tabs at the beginning of lines to visually represent the structure and hierarchy of the program, to make it more readable.
Do you know? Syntax refers to the rules and structure that determine how to write lines of code in programming. Indentation means adding spaces or tabs at the beginning of a line to show its position.
The book's worked example — a pseudocode to compute the area of a rectangle (the book notes that it is written in order with a clear objective starting with //, uses simple English words like Input and Display, follows proper naming conventions, and uses "Begin" and "End" to mark the starting and ending points):
Begin
Input Length.
Input Width.
Compute Area = Length * Width.
Display Area.
End
📚 Book Vocabulary — Words in this part
Pseudocode — A way of representing an algorithm using human understandable language; a formal way of writing instructions to describe the steps of an algorithm. (Book's Important Points and Summary, printed pp 87, 90.) ⭐Book word
🌱 Extra Help Words — Words in this part
Indentation — The spaces or tabs added at the beginning of a line to show its position in the structure of the pseudocode.
Part 5 — Constructs and variables: sequence, constants and variables (printed pp 67–70)
3.7 Constructs and Variables. Algorithms are built from constructs — sequence, conditions and loops — working with values stored as constants and variables. 3.7.1 Constants. A constant is a value that does not change. The book's examples are: days in a week (7), hours in a day (24), and Pi in maths (π). Its code example is:
days_in_week = 7
hours_in_day = 24
PI = 3.14
3.7.2 Variable. A variable is a storage location that holds a value which can change during execution. The book's examples:
score = 10
score = score + 5
Here score first holds 10, and after the second line it holds 15 — its value changed, which is exactly what makes it a variable. The book's second example stores a name: student_name = "Zara", and the value can later be updated to "Zain".
3.8 Sequential Flow Construct in Problem Solving. In a sequence, the steps of an algorithm are executed one after another, in order. The book's example — a pseudocode for displaying the square of a number:
Begin
Input Number.
Compute Square = Number * Number.
Display Square.
End
📚 Book Vocabulary — Words in this part
Constant — A value that does not change during the execution of a program. (Book's Summary, printed p 87.) ⭐Book word
Variable — A storage location in a program that holds a value that can change during execution. (Book's Summary, printed p 87.) ⭐Book word
Sequence — The order in which steps in an algorithm are executed. (Book's Important Points, printed p 90.) ⭐Book word
🌱 Extra Help Words — Words in this part
Syntax — The rules and structure that determine how to write lines of code in a programming language.
Part 6 — Conditions in problem solving (printed pp 70–74)
3.9 Conditions in Problem Solving. A condition lets an algorithm make a decision: it checks whether something is true or false, and acts accordingly. The book teaches three forms.
The If statement performs an action only when its condition is true:
perform action-1
Worked form: IF it is raining — take an umbrella. If it is not raining, nothing happens.
The If-Else statement performs one action when the condition is true and a different, default action when it is false:
Take an umbrella
ELSE
Wear the sunglasses
perform action-1
ELSE
perform default action
Flow of an If-Else statement (redrawn from the book's Figure 3.11, printed p 72): the condition is tested; if it is true, action-1 is taken, and if it is false, action-2 is taken; then the algorithm ends. (100MCQs diagram.)
The IF-ELIF-ELSE statement tests a chain of conditions in order and runs the action of the first one that is true; if none is true, the ELSE (default) action runs. The book's weather example: IF weather is "sunny" then wear glasses, ELIF weather is "rainy" then take an umbrella, ELIF weather is "snowy" then build a snowman, ELSE "Enjoy the weather".
Flow of the IF-ELIF-ELSE weather example (redrawn from the book's Figure 3.12, printed p 73): each condition is tested in order; the first true one runs its action and exits; if all are false, the ELSE action runs. In words: sunny → wear glasses; rainy → take an umbrella; snowy → build a snowman; anything else → enjoy the weather. (100MCQs diagram.)
The generic form of the chain is:
perform action-1
ELIF condition-2
perform action-2
ELIF condition-3
perform action-3
.
.
ELSE
perform default action
Quick Tip (book): If, If-Else and If-Elif-Else are called selection statements, because they select which action to perform.
📚 Book Vocabulary — Words in this part
Condition — A statement that checks whether something is true or false (e.g., if-else). (Book's Important Points, printed p 90.) ⭐Book word
🌱 Extra Help Words — Words in this part
Trace — To follow an algorithm step by step with sample values, checking exactly what it does — the surest way to catch a logic mistake.
Part 7 — Loops and nesting (printed pp 75–78)
3.10 Loop. In computer programming, a loop is used to repeat an action many times. Loops are also called iterative statements. A loop is a basic programming construct that repeats a single or a set of instructions until a given condition is met — like saying, "Keep doing this until I say stop!"
3.10.1 Repeat Loop. The repeat loop is ideal when you know exactly how many times you need an action to repeat or iterate. It is especially useful where you need a specific number of iterations to complete a task — for example, addition of numbers, counting occurrences, iterating through a fixed number of items in a list, moving a character a set number of spaces, or collecting data a specific number of times. The book's example — counting down from 5 to 1:
2. Set counter = 5
3. Repeat 5 times:
4. Display counter
5. Decrease counter by 1
6. End
Traced: the algorithm displays 5, 4, 3, 2, 1 in sequence and then stops, exactly as the book states.
3.10.2 Forever Loop. A forever loop (or infinite loop) is useful when you want an action to repeat indefinitely. Forever loops are useful in games, animations, and programs that need to iterate constantly — for example, displaying balloons moving in the background of an image. The book's example — counting coins in a game:
2. Set coins_collected = 0
3. Forever:
4. Collect a coin
5. Increase coins_collected by 1
6. Display "Coins collected so far: [coins_collected]"
7. End
3.11 Concept of Nesting. Nesting means placing one construct inside another — a loop inside a loop, or a condition inside a condition — to create more complex logic. 3.11.1 Nested Loops. The book's example counts the days of 3 weeks (Figure 3.13: an outer loop iterating three times for the weeks, and an inner loop iterating 7 times to count the days in a week):
week ← 1
REPEAT // Outer loop for 3 weeks
day ← 1
REPEAT // Inner loop for 7 days
PRINT " Day", day
day ← day + 1
UNTIL day > 7
week ← week + 1
UNTIL week > 3
END
Traced: the inner loop prints Day 1 to Day 7 for each week, so the algorithm prints 21 day lines in total (3 weeks × 7 days) — the inner loop always runs completely before the outer loop moves on.
3.11.2 Nested Conditions. A condition can also be nested inside another condition. The book's example: Rubaisha can go to the park only if it is sunny and she has permission:
IF Rubaisha has permission
Display "Rubaisha can go to the park!"
ELSE
Display "Rubaisha cannot go to the park because she does not have permission."
ELSE
Display "Rubaisha cannot go to the park because it is not sunny."
Traced: all three outcomes are routed correctly — sunny with permission → she can go; sunny without permission → the permission message; not sunny → the weather message, and the inner condition is never even checked.
📚 Book Vocabulary — Words in this part
Loop — A construct that repeats a set of instructions multiple times (e.g., for, while). Loops are also called iterative statements. (Book's Important Points and §3.10, printed pp 75, 90.) ⭐Book word
Repeat Loop — A loop that iterates a set of instructions a specific number of times; ideal when you know exactly how many times an action must repeat. (Book's Summary and §3.10.1, printed pp 75, 87.) ⭐Book word
Forever Loop — A loop that iterates indefinitely until interrupted; useful in games, animations and programs that need to iterate constantly. (Book's Summary and §3.10.2, printed pp 75, 87.) ⭐Book word
Nesting — Placing one construct (like loops or conditional statements) inside another to create more complex logic. (Book's Summary, printed p 87.) ⭐Book word
🌱 Extra Help Words — Words in this part
Iteration — One single run through the steps inside a loop; a loop with 5 cycles has 5 iterations.
Part 8 — Applying problem solving: the grade algorithm (printed pp 80–81)
3.12 Applying Problem Solving Technique. This section applies the three techniques — sequence, loops and conditions — together to one scenario. Problem: write an algorithm to determine the grade of a student based on the marks entered. The algorithm needs to do the following: 1. Check if the marks are valid (between 0 and 100). 2. If valid, determine the grade based on the score: if the score is 90 or more, print "A"; if the score is 80 or more, print "B"; if the score is 70 or more, print "C"; otherwise, display "Fail". 3. Repeat this for multiple students.
The book shows how the scenario uses all three techniques. Sequence: the steps happen in order — ask, check, grade. Conditions: an IF-Else condition validates the marks (if the marks are outside the range — less than 0 or greater than 100 — the algorithm informs the user that the input is invalid), and an IF-ELIF-ELSE chain determines the grade (90 or above: Grade A; 80–89: Grade B; 70–79: Grade C; below 70: Fail). Loop: a repeat (for) loop runs the process for each student, because the algorithm must check the marks of multiple students, not just one. The complete algorithm, as printed on p 81, is:
2. // Ask for the number of students
DISPLAY "Enter the number of students:"
3. READ number_of_students
4. // Loop for each student
FOR student FROM 1 TO number_of_students DO
5. // Ask for marks
DISPLAY "Enter marks for student ", student, ":"
6. READ marks
7. // Validate marks (check if they are between 0 and 100)
IF marks < 0 OR marks > 100 THEN
8. DISPLAY "Invalid marks. Please enter marks between 0 and 100."
9. CONTINUE // Skip the current iteration and ask for marks again
10. // Determine grade based on the marks
IF marks >= 90 THEN
11. DISPLAY "Grade: A"
12. ELSE IF marks >= 80 THEN
13. DISPLAY "Grade: B"
14. ELSE IF marks >= 70 THEN
15. DISPLAY "Grade: C"
16. ELSE
17. DISPLAY "Fail"
END IF
18. END FOR
The book annotates the algorithm by construct: steps 1–3 represent the sequential flow, steps 4–6 the repeat (for) loop, steps 7–9 the IF construct, and steps 10–17 the IF-ELIF-ELSE construct. The grade chain itself is correct: marks of exactly 0 and 100 are treated as valid, and the 90/80/70 thresholds match the specification on p 80.
📚 Book Vocabulary — Words in this part
Validation — Checking that input is acceptable before it is used — in the grade algorithm, checking that marks are between 0 and 100. (Book's grade algorithm, printed p 81.) ⭐Book word
🌱 Extra Help Words — Words in this part
Efficiency — How good an algorithm is in its use of time and memory; an efficient algorithm wastes neither.
Part 9 — Comparing algorithms and selecting the best solution (printed pp 82–86)
3.13 Comparing the Performance of Two Algorithms. The book opens this section by comparing two ways of making a cup of tea (Figure 3.14): the same problem can be solved by different step-by-step methods, and the methods can be compared. Do you know? The speed and efficiency of an algorithm is measured in terms of Time Complexity and Space Complexity: an algorithm will be efficient if it is taking less processing time and less storage space in a computer system.
First comparison — swapping two numbers. Algorithm-1 uses a temporary variable:
Step-2: Take two numbers 'a' and 'b' as input.
Step-3: Create a temporary variable, 'temp'.
Step-4: Store the value of first variable, 'a' in 'temp'.
Step-5: Assign the value of variable, 'b' to variable, 'a'.
Step-6: Assign the value of variable, 'temp' to variable, 'b'.
Step-7: Display the values of swapped variable, 'a' and 'b'.
Step-8: End
The book's trace box: let a = 5 and b = 10. 1. temp = a → temp = 5; 2. a = b → a = 10; 3. b = temp → b = 5. Result: a = 10, b = 5. ✓ Algorithm-2 swaps without a temporary variable, using arithmetic:
Step-2: Take two numbers 'a' and 'b' as input.
Step-3: Add 'a' and 'b' and assign the result to 'a'. // Now 'a' holds the sum of both numbers.
Step-4: Subtract the new value of 'a' by 'b' and assign the result to 'b'. // Now 'b' holds the original value of 'a'.
Step-5: Subtract the new value of 'b' from 'a' and assign the result to 'a'. // Now 'a' holds the original value of 'b'.
Step-6: Display the values of swapped variable 'a' and 'b'
Step-7: End
The book's trace box: let a = 5 and b = 10. 1. a = a + b → a = 15; 2. b = a − b → b = 5; 3. a = a − b → a = 10. Result: a = 10, b = 5. ✓ The book's discussion is a fair trade-off: Algorithm-1 requires an extra variable, temp, which takes extra space in memory; Algorithm-2 saves the space but involves the use of arithmetic operations.
Second comparison — the average of five numbers. Algorithm-1, without a loop (10 steps):
Step-2: Take first number 'n1' as input.
Step-3: Take second number 'n2' as input.
Step-4: Take third number 'n3' as input.
Step-5: Take fourth number 'n4' as input.
Step-6: Take fifth number 'n5' as input.
Step-7: Calculate the sum of the five numbers as, sum = n1 + n2 + n3 + n4 + n5.
Step-8: Calculate the average as, average = sum / 5.
Step-9: Display the average.
Step-10: End
Algorithm-2, using a loop (7 steps):
Step-2: Consider initial value of sum as zero, sum=0.
Step-3: Use a loop with five cycles.
Step-4: For each cycle of the loop do the following:
a. Take input of a number.
b. Add the input number to sum.
Step-5: Calculate the average as, sum divide by 5.
Step-6: Display the average.
Step-7: End
The book concludes that Algorithm-1 requires more steps (a total of 10) and is simpler when averaging exactly five numbers, while Algorithm-2 requires fewer steps (only 7) and offers flexibility — the number of inputs can easily be changed; if the number of inputs is expected to change often, Algorithm-2 is the better option.
3.14 Selection of Alternate Solution. Often a problem has several correct solutions, and we must select the best one. The book's problem: find whether a given positive number is prime or not. It gives three solutions. Solution-1 tests every divisor from 2 to n−1:
Step-2: Take a number 'n' as input.
Step-3: If the 'n' is greater than 1, keep on dividing this number with natural number starts from 2 and ending with n-1.
Step-4: If any number from 2 to n-1 divides 'n' and you get the reminder 0, print that the number 'n' is not a prime number.
Step-5: If step-4 fails, display that the number is prime.
Step-6: End
Solution-2 tests divisors only up to n/2 — because no divisor of n (other than n itself) can be larger than n/2:
Step-2: Take a number 'n' as input.
Step-3: If the 'n' is greater than 1, keep on dividing this number with natural number starts from 2 and ending with n/2.
Step-4: If any number from 2 to n-1 divides 'n' and you get the reminder 0, print that the number 'n' is not a prime number.
Step-5: If step-4 fails, display that the number is prime.
Step-6: End
Solution-3 tests divisors only up to the square root of n — because if n has a divisor larger than √n, it must also have one smaller than √n:
Step-2: Take a number 'n' as input.
Step-3: If the 'n' is greater than 1, keep on dividing this number with natural number starts from 2 and ending with square-root of n.
Step-4: If any number from 2 to n-1 divides 'n' and you get the reminder 0, print that the number 'n' is not a prime number.
Step-5: If step-4 fails, print that the number is prime.
Step-6: End
The book's analysis: all three solutions are correct but different; the calculations start from 2 and end on n−1 in the first solution, on n/2 in the second, and on the square root of n in the third; since the square root of n is the smallest of these limits, the third solution offers the least number of steps with maximum efficiency, and is selected as the best solution. ("Reminder" in the printed steps is the book's spelling of "remainder".)
📚 Book Vocabulary — Words in this part
Time Complexity — The speed and efficiency of an algorithm measured by the processing time it takes. An algorithm is efficient if it takes less processing time. (Book's 'Do you know?' box, printed p 83.) ⭐Book word
Space Complexity — The efficiency of an algorithm measured by the storage space it uses in a computer system. (Book's 'Do you know?' box, printed p 83.) ⭐Book word
🌱 Extra Help Words — Words in this part
Divisor — A number that divides another number exactly, leaving a remainder of zero — for example, 3 is a divisor of 9.
Prime Number — A number greater than 1 whose only divisors are 1 and the number itself — for example, 2, 3, 5 and 7.
Part 10 — Problems that cannot be solved computationally; unit summary (printed pp 86–87)
3.15 Problems That Cannot be Solved Computationally. Although computers are powerful tools, they still have limitations. Some problems cannot be solved by computer; these problems are too complex or unpredictable. An example is the halting problem. The term "halting" means stopping or finishing a program after it has run for a while. The book states the problem like this: the halting problem happens when a computer cannot tell if a program will ever stop. Its example: if our program does not halt, it will keep the CPU busy forever; in programming, we say it is an infinite loop, and our programs should never get into infinite loops, otherwise the system will not work properly. The book's Summary states the problem more precisely: "The halting problem is the challenge of determining whether a program will eventually stop or run forever for a given input."
Unit Summary (printed p 87), the book's own summary of the chapter:
- Simple problems are those which are easy to understand, analyze and solve.
- Complex problems are those which take more time and effort to solve because they involve multiple parts or steps.
- Scope of a problem refers to the boundaries or limits that define what the problem includes and what it does not.
- Pseudocode is a formal way of writing instructions in human understandable language to describe the steps of an algorithm.
- A constant is a value that does not change during the execution of a program.
- A variable is a storage location in a program that holds a value that can change during execution.
- Conditional statements allow a program to make decisions based on whether a condition is true or false.
- A repeat loop iterates a set of instructions a specific number of times, while a forever loop iterates indefinitely until interrupted.
- Nesting refers to placing one construct (like loops or conditional statements) inside another to create more complex logic.
- The performance of two algorithms refers to how efficiently they solve a given problem.
- There are different ways to solve the same problem, each leading to the correct outcome. These solutions may vary in approach, steps, or efficiency.
- The halting problem is the challenge of determining whether a program will eventually stop or run forever for a given input.
📚 Book Vocabulary — Words in this part
Halting Problem — The problems which cannot be solved computationally; the challenge of determining whether a program will eventually stop or run forever for a given input. (Book's Important Points and Summary, printed pp 87, 90.) ⭐Book word
🌱 Extra Help Words — Words in this part
Undecidable — Describes a problem for which no algorithm can give a correct yes-or-no answer for every possible input; the halting problem is undecidable.
