Computer Science: Computational Thinking and Programming

KS3

CO-KS34-D001

Understanding and applying computational abstractions; using two or more programming languages (at least one text-based); understanding data structures; designing and writing modular programs; using Boolean logic and binary.

National Curriculum context

At KS3 and KS4, computer science develops into a rigorous academic discipline. Pupils are expected to work with computational abstractions that model real-world problems, making the connection between computational approaches and the problems they solve. Programming extends to at least two languages, at least one of which must be text-based, reflecting the reality that different programming languages are suited to different tasks and that professional programmers work with multiple languages. Data structures - arrays, lists, records, stacks, queues, trees - extend programming capability beyond simple variables. Boolean logic and binary underpin the mathematical foundations of digital computation, connecting computing to mathematics and providing insight into how hardware operates at the lowest levels.

2

Concepts

1

Clusters

2

Prerequisites

2

With difficulty levels

AI Direct: 2

Lesson Clusters

1

Understand algorithms and use data structures in modular programs

practice Curated

Algorithms (sorting, searching, complexity) and data structures with modular programming are explicitly co-taught: C001 lists C003 in its co_teach_hints. Classic algorithms are most meaningfully implemented and analysed using appropriate data structures and modular code, and these two concepts are always encountered together in the programming strand at KS3/4.

2 concepts Systems and System Models

Teaching Suggestions (5)

Study units and activities that deliver concepts in this domain.

Algorithms: Searching and Sorting

Computing Practical Application
Pedagogical rationale

The NC specifically requires pupils to understand key algorithms including sorting and searching. Linear search and binary search demonstrate that algorithm choice affects efficiency dramatically (binary search is O(log n) vs O(n)). Bubble sort, insertion sort and merge sort show that the same problem (ordering data) can be solved in fundamentally different ways with different performance characteristics. Unplugged activities (sorting pupils by height, searching for a card) make abstract algorithms concrete before implementing in code.

Boolean Logic and Binary Arithmetic

Computing Practical Application
Pedagogical rationale

Boolean logic (AND, OR, NOT) underpins both programming (conditional expressions) and hardware (logic gates). Binary number representation explains how computers store and process all data. Teaching these together reveals that the logical and mathematical foundations of computing are deeply connected. Unplugged binary counting (with cards showing 1, 2, 4, 8, 16) and logic gate circuits (using simple switches or online simulators) make the abstract concrete.

Data Structures and Modular Programming

Computing Practical Application
Pedagogical rationale

After learning basic programming, pupils need to organise data and code. Data structures (lists/arrays, dictionaries, records) teach that choosing how to store data affects how easily it can be processed. Modular programming (functions and procedures) teaches that code should be organised into reusable, testable blocks. A project like a student database or quiz system naturally requires both data structures and modular code, making the need for these concepts genuine rather than manufactured.

Python Programming: Fundamentals

Computing Practical Application
Pedagogical rationale

Python is the standard text-based language for KS3 because its clean syntax (enforced indentation, minimal boilerplate) makes it the most readable language for novice programmers transitioning from block-based environments. This unit covers variables, data types, input/output, selection (if/elif/else), iteration (for and while loops), and string manipulation. Each concept is introduced through a small practical project rather than isolated exercises.

Web Development: HTML, CSS and JavaScript

Computing Practical Application
Pedagogical rationale

Web development fulfils the NC requirement for a second programming language and produces a visible, shareable outcome. HTML (structure), CSS (presentation), and JavaScript (behaviour) demonstrate separation of concerns -- a fundamental software engineering principle. Building a multi-page website with interactive elements (form validation, image galleries, responsive layout) requires all three languages working together. Every website pupils use daily is built with these technologies, making the learning immediately relevant.

Prerequisites

Concepts from other domains that pupils should know before this domain.

Concepts (2)

Algorithms: Sorting, Searching and Complexity

knowledge AI Direct

CO-KS34-C001

Classic algorithms for sorting (bubble sort, merge sort, quick sort) and searching (linear search, binary search) represent fundamental computational problems with well-understood solutions of different efficiencies. Algorithm complexity - how the time or space required by an algorithm grows as the input size grows - is expressed using Big O notation (O(n), O(n log n), O(n^2)). Understanding that different algorithms solving the same problem have different performance characteristics, and that the choice of algorithm matters at scale, is a key insight of computer science. At KS3, pupils study these algorithms, understand how they work and begin to compare their relative efficiency.

Teaching guidance

Implement sorting and searching algorithms in code and trace their execution with small data sets. Use physical activities (sorting cards, searching for a name in a list) to make the algorithms tangible before coding. Compare the steps required by linear and binary search for different list sizes to develop intuitive understanding of efficiency. Trace merge sort recursively to understand divide-and-conquer approaches. Connect to real applications: how does a database search work? Why does Google search so quickly? Introduce Big O notation as a way of expressing relative efficiency.

Vocabulary: algorithm, sort, search, bubble sort, merge sort, binary search, linear search, efficiency, complexity, Big O, trace, comparison, swap, iteration, recursion
Common misconceptions

Pupils may assume the algorithm they first learned is the best for all cases. Exploring performance with different input sizes and orders demonstrates that no single algorithm is always optimal. Binary search's requirement for a sorted list is often overlooked; understanding the preconditions of an algorithm is part of understanding the algorithm. Tracing recursive algorithms like merge sort can be confusing; explicit tree diagrams that show recursive calls make the structure visible.

Difficulty levels

Emerging

Understands that algorithms are step-by-step instructions for solving a problem, and can trace through a simple algorithm with small inputs, but cannot compare algorithms or explain efficiency.

Example task

Here is a list of 5 numbers: [8, 3, 5, 1, 9]. Trace through a bubble sort, showing the list after each pass.

Model response: Pass 1: Compare 8,3 → swap → [3,8,5,1,9]. Compare 8,5 → swap → [3,5,8,1,9]. Compare 8,1 → swap → [3,5,1,8,9]. Compare 8,9 → no swap → [3,5,1,8,9]. Pass 2: Compare 3,5 → no swap. Compare 5,1 → swap → [3,1,5,8,9]. Compare 5,8 → no swap. Compare 8,9 → no swap → [3,1,5,8,9]. Pass 3: Compare 3,1 → swap → [1,3,5,8,9]. Remaining comparisons → no swaps. List is now sorted.

Developing

Can explain how several sorting and searching algorithms work, and recognises that different algorithms solve the same problem with different efficiency, though cannot yet quantify this using Big O notation.

Example task

Explain how binary search works and why it is faster than linear search for a sorted list of 1000 items.

Model response: Linear search checks each item from the beginning until it finds the target — in the worst case, it checks all 1000 items. Binary search starts in the middle of the sorted list, checks if the target is higher or lower, then eliminates half the remaining items. It repeats this halving process. For 1000 items: first check eliminates 500, second eliminates 250, then 125, 63, 32, 16, 8, 4, 2, 1 — so binary search needs at most about 10 comparisons instead of 1000. Binary search requires the list to be sorted first, which is a precondition that linear search does not need.

Secure

Implements sorting and searching algorithms in code, uses Big O notation to describe algorithmic complexity, and selects appropriate algorithms for given problem constraints.

Example task

Compare bubble sort and merge sort in terms of their time complexity. For a list of 1 million items, explain which you would choose and why.

Model response: Bubble sort has time complexity O(n squared): for each of n items, it may need to make up to n comparisons, giving n times n operations. For 1 million items, this is approximately 1 trillion operations — far too slow for practical use. Merge sort has time complexity O(n log n): it repeatedly divides the list in half (log n divisions) and merges the halves (n operations per merge level). For 1 million items, log base 2 of 1 million is approximately 20, so merge sort needs about 20 million operations — roughly 50,000 times faster than bubble sort. I would choose merge sort because O(n log n) scales far better than O(n squared). However, merge sort uses additional memory (to store the split sublists), so if memory is extremely limited, I might consider in-place algorithms like quicksort.

Mastery

Analyses algorithmic trade-offs in real-world contexts, understands that no single algorithm is optimal for all situations, and evaluates algorithm choice based on input characteristics, constraints and requirements.

Example task

A hospital database needs to search patient records in real time during emergencies. The database contains 50 million records. Evaluate the algorithm and data structure choices that would make this possible.

Model response: Linear search at O(n) would require checking up to 50 million records — unacceptable for emergency response. Binary search at O(log n) would need about 26 comparisons, which is fast enough, but requires the data to be sorted. For a database that changes frequently (new patients, updated records), maintaining sort order is costly. A better approach is a hash table: using the patient's NHS number as a key, a hash function maps it directly to a memory location in O(1) average time — effectively instant lookup regardless of database size. However, hash tables have weaknesses: they do not support range queries (find all patients aged 30-40) and hash collisions degrade performance. A balanced binary search tree (e.g., B-tree, used in real database indexes) offers O(log n) search with efficient insertion and deletion, and supports range queries. In practice, hospital databases use B-tree indexes on key fields (NHS number, name, date of birth) combined with hash indexes for exact-match lookups. The choice depends on the query type: exact match (hash), range (B-tree), or full-text (inverted index). No single algorithm covers all needs.

Delivery rationale

Computing concept — inherently digital subject with strong tool support.

Data Structures and Modular Programming

skill AI Direct

CO-KS34-C003

Data structures are ways of organising and storing data in a program so that it can be accessed and modified efficiently. Common data structures include arrays (indexed collections of items of the same type), lists (dynamic ordered collections), stacks (last-in, first-out collections), queues (first-in, first-out collections), and dictionaries/hash maps (key-value pair collections). Modular programming organises code into self-contained procedures or functions, each responsible for a specific task. This improves readability, enables reuse and simplifies debugging. At KS3, pupils learn to choose appropriate data structures and to design modular programs using procedures and functions.

Teaching guidance

Introduce data structures through problems they naturally solve: arrays for storing a list of scores, a stack for undo operations, a queue for a print job buffer. Teach pupils to choose data structures based on the operations required. Model modular program design: identify distinct tasks, write a function for each, test functions independently. Practice refactoring flat programs into modular ones. Connect data structures to real applications: how does a social media platform store users' friend lists? Develop understanding of the difference between accessing an element by index and searching through a list.

Vocabulary: data structure, array, list, stack, queue, dictionary, record, index, procedure, function, parameter, return, modular, reuse, encapsulate
Common misconceptions

Pupils may not see the need for data structures beyond simple variables, especially in small programs. Showing how programs that use appropriate data structures scale to larger problems motivates their use. The difference between passing data to a function by value and by reference is a subtle but important concept that affects program behaviour. Functions that return values are often confused with procedures that only produce side effects; consistent terminology and practice develops clarity.

Difficulty levels

Emerging

Can write simple programs using variables, sequence and basic selection (if/else), but does not use data structures beyond single variables or organise code into procedures or functions.

Example task

Write a program that asks the user for their age and tells them whether they are old enough to vote (18 or over).

Model response: age = int(input('Enter your age: ')) if age >= 18: print('You are old enough to vote.') else: print('You are not old enough to vote yet.')

Developing

Uses arrays/lists to store collections of data, writes programs with loops that process data structures, and begins to organise code into procedures or functions for clarity.

Example task

Write a program that stores 5 test scores in a list, calculates the average, and prints which scores are above the average.

Model response: scores = [72, 85, 63, 91, 78] total = 0 for score in scores: total = total + score average = total / len(scores) print('Average:', average) for score in scores: if score > average: print(score, 'is above average')

Secure

Chooses appropriate data structures for different problems, writes modular programs using functions with parameters and return values, and debugs programs systematically.

Example task

Write a function called 'find_max' that takes a list of numbers as a parameter and returns the largest number, without using the built-in max() function.

Model response: def find_max(numbers): if len(numbers) == 0: return None largest = numbers[0] for number in numbers[1:]: if number > largest: largest = number return largest # Test print(find_max([3, 7, 2, 9, 5])) # Should print 9 print(find_max([-5, -1, -8])) # Should print -1 print(find_max([42])) # Should print 42 print(find_max([])) # Should print None

Mastery

Designs programs using appropriate data structures (stacks, queues, dictionaries), writes well-structured modular code with clear documentation, and analyses the efficiency and robustness of their solutions.

Example task

Design a program for a library book-borrowing system. It should track which books are available, allow borrowing and returning, and use appropriate data structures. Justify your data structure choices.

Model response: I would use a dictionary where each key is the book's ISBN and the value is another dictionary containing title, author and status (available/borrowed/borrower_name). library = {} def add_book(isbn, title, author): library[isbn] = {'title': title, 'author': author, 'status': 'available', 'borrower': None} def borrow_book(isbn, borrower): if isbn not in library: return 'Book not found' if library[isbn]['status'] == 'borrowed': return f'Already borrowed by {library[isbn]["borrower"]}' library[isbn]['status'] = 'borrowed' library[isbn]['borrower'] = borrower return f'{library[isbn]["title"]} borrowed by {borrower}' def return_book(isbn): if isbn not in library or library[isbn]['status'] == 'available': return 'Error: book not currently borrowed' library[isbn]['status'] = 'available' library[isbn]['borrower'] = None return f'{library[isbn]["title"]} returned' Justification: A dictionary provides O(1) average lookup by ISBN — essential for a system that may contain thousands of books. Using a list would require O(n) linear search. The nested dictionary for each book groups related data logically. Functions are modular: each handles one operation with input validation and clear return messages.

Delivery rationale

Computing concept — inherently digital subject with strong tool support.