B1.1 Approaches to Computational Thinking

Revision notes. Everything in the syllabus, nothing extra.

Contents

Computational thinking is a way of approaching a problem so that its solution can be carried out by a computer. It rests on four concepts:

ConceptIn one line
DecompositionBreak a big problem into smaller parts.
Pattern recognitionSpot similarities so one solution can be reused.
AbstractionRemove unnecessary detail, keep what matters.
Algorithmic designWrite clear step by step instructions to solve it.
Break it, spot it, simplify it, solve it.

B1.1.1: Problem Specification

A problem specification defines exactly what must be solved before anyone starts solving it. It has six parts. Every part must be clear, specific and measurable.

PartWhat it saysWeakStrong
1. Problem statementWhat the problem is and why it matters. Concise, specific, no ambiguity."Our customer service is inefficient.""Customers wait an average of 25 minutes on hold, causing a 15% rise in abandoned calls last quarter."
2. Constraints and limitationsRestrictions on the solution: resources (time, budget, staff), technical (hardware, software), external (laws, other systems)."We don't have many resources.""The budget is limited to $10,000 and cannot be exceeded due to funding rules."
3. Objectives and goalsObjective: broad, high level aim. Goals: specific, measurable, time limited targets that achieve it."Make customers happier."Objective: reduce wait times. Goal: cut average hold time by 20% within the next quarter.
4. Input specificationThe format, type and expected characteristics of the data going in."Customer feedback."Star ratings 1 to 5, free text comments and NPS scores, collected straight after the interaction and linked to the customer.
5. Output specificationThe format, content and presentation of the results coming out."Some reports."A dashboard with weekly satisfaction charts, filterable by date and channel, plus alerts for very negative feedback.
6. Evaluation criteriaThe benchmarks used to judge whether the solution worked."It works well."The chatbot resolves 70% of enquiries without a human and scores 4/5 on post chat surveys.

NPS (net promoter score) rates how likely a customer is to recommend the company to a friend.

Evaluation criteria: the five factors

FactorQuestionChatbot example
EffectivenessDoes it solve the problem?% of enquiries resolved without a human
EfficiencyDoes it save time or resources?Faster resolution, available 24/7, less load on staff
AccuracyAre the results correct?Correct answers, understands different phrasings of the same request
UsabilityIs it easy to use?Simple interface, clear prompts, little training needed
MaintainabilityCan it be updated and adapted?New questions or channels can be added easily, data kept safe
Ninja Notes:
  • Learn the six parts in order: Statement, Constraints, Objectives and goals, Inputs, Outputs, Evaluation.
  • If it can't be measured, it's not a good goal. Numbers plus a time limit.
  • Goals become your evaluation criteria at the end. This is exactly how your IA works.

B1.1.2: The Four Concepts

Decomposition

Definition: breaking a complex problem down into smaller, more manageable parts that can each be understood and solved separately.
Decomposing a game NPC (non playing character)
SensingPerceive the player and surroundings (sight, hearing).
Decision makingEvaluate the situation and choose an action (behaviour tree, finite state machine).
ActionsPatrol, attack, flee, hide.
PathfindingNavigate the world to reach a goal.

The textbook also shows a deeper split: motivation (goals, personality), perception (sensory input, filtering), decision making (behaviour library, evaluation module), action execution (animation, movement). Both are valid. Decomposition keeps going until each part is simple.

Pattern recognition

Definition: identifying similarities, trends or regularities within or between problems, so that a solution to one can be generalised and reused instead of solving each variation from scratch.

Abstraction

Definition: filtering out unnecessary details to focus on the essential features of a problem, and representing it as a simplified model.
Predicting a winnerKeepIgnore
Football matchSerious injuries, past results between the teamsShoelace colour, probably player age
Car raceCar performance (engine, tyres, aerodynamics), driver skill, track suitability, weather, chance of mechanical failureCar colour, driver's favourite snack, cloud shapes

The race model becomes a few scores out of 10 plus failure chances. It is a simplification, but a useful one. That is the essence of abstraction.

Algorithmic design

Definition: developing a step by step set of instructions (an algorithm) that solves a problem. It must be clear, precise, unambiguous and efficient.

B1.1.3: Applying Computational Thinking

In an "explain how" question, go through all four concepts and give one specific example of each in the scenario.

FieldDecompositionPattern recognitionAbstractionAlgorithmic design
Software development (CRM system)Modules: lead tracking, customer management, communicationRecording common bugs to speed up future debuggingOOP objects with reusable methodsExact rules and steps for automatic email scheduling
Data analysis (sales data)Cleaning, normalisation, analysisSeasonal sales trends to predict demandFocus on KPIs, filter out irrelevant dataETL pipeline: extract, transform, load
Machine learningData collection, features, training, evaluation, deploymentFinding image features that classify objects (CNNs)Data represented as features and labelsNetwork design: layers, activation functions, optimiser
Database designConceptual, logical, physical stagesCommon queries, so index or denormalise for themTables that model real entities, ignore irrelevant detailEfficient querying, updating, transactions for integrity
Network securityPhysical, infrastructure, application securityKnown attack patterns (DDoS, phishing)Generic security models and protocolsEncryption algorithms and protocols (TLS)

B1.1.4: Tracing Flowcharts

A flowchart is a diagram that shows the steps, decisions and flow of control of an algorithm using standard symbols (ISO 5807). It is read top to bottom, left to right.

Start x = x + 1 Input x x > 5? A TerminalProcessInput / OutputDecisionConnectorFlowline start or endcalculation, assignmentread in or print outyes/no questionjump to same letterorder of steps

How to trace

  1. Draw a trace table: one column per variable, one for each decision, one for output.
  2. Follow the arrows exactly. Write a new row every time a value changes.
  3. At every diamond, work out the condition with the current values and follow that exit.
  4. Stop at End. Check the last pass, where the decision finally flips. Off by one mistakes live there.

Example 1: a simple decision

Start Do I havehomework? Do not play Play for a while End YesNo

Example 2: a loop (guess the number)

Start SECRET = randomnumber from 1 to 10 Input guess guess = SECRET? Output "Wrong,try again" Output "You win!" End NoYes

The "No" path loops back to the input, so the player keeps guessing until the decision becomes "Yes".

Example 3: linear search

Checks every element in turn from index 0 until it finds the target or reaches the end. Array: 2, 4, 6, ... 100. Target: 42.

Start i = 0 array[i] = TARGET? Output "Found at" i End i = last index? Output "Not found" End i = i + 1 YesNo YesNo

42 sits at index 20, so the loop checks indexes 0 to 20 and outputs "Found at 20" after 21 comparisons. Searching for 43 would check all 50 elements, then output "Not found".

Example 4: how many iterations?

Start A = 10B = 100 A > B? End B = B − 10A = A + 10 YesNo
IterationABA > B?
start10100No
12090No
23080No
34070No
45060No
56050Yes → End

5 iterations. The loop body runs 5 times, but the decision is checked 6 times. Read the question carefully to see which one it asks for.

Practice

  1. Splitting a game into a menu screen, a play screen and a score screen.
  2. Ignoring a car's colour when predicting a race winner.
  3. Noticing three parts of a program all sort a list, so writing one sort function.
  4. Writing the exact steps for when an email reminder is sent.
a. Decomposition   b. Abstraction   c. Pattern recognition   d. Algorithmic design

"The school website is bad and students do not like it."

"Students need an average of 5 clicks to find the timetable on the school website, and 60% of surveyed students could not find it at all, which has doubled timetable emails to the office." Specific problem, numbers, and why it matters.

A school canteen has long queues at lunch.

Objective: reduce the time students spend queuing for lunch.
Goals: cut the average queue time from 15 to 5 minutes by the end of term. Serve 90% of students within the first 20 minutes of lunch by January. Both are measurable and time limited.
Removing / filtering out unnecessary details [1] so that only the essential features of a problem remain, giving a simplified model [1].

Set x = 12 and y = 8. While x ≠ y: if x > y then x = x − y, otherwise y = y − x. When they are equal, output x.

xyx ≠ y?Action
128Yesx = 12 − 8 = 4
48Yesy = 8 − 4 = 4
44NoOutput 4
Output: 4. This is Euclid's algorithm for the greatest common divisor.

Set total = 0 and n = 1. While total < 20: total = total + n, then n = n + 2. Output total and n.

Iterationtotalntotal < 20?
start01Yes
113Yes
245Yes
397Yes
4169Yes
52511No
5 iterations. Output: total = 25, n = 11. Pattern recognition bonus: adding odd numbers gives square numbers.
Ninja Notes: