National Year 10 Computer Science
Chapters: 3
1. 3.1 Fundamentals of algorithms
3.1.1 Representing algorithms · 3.1.2 Efficiency of algorithms · 3.1.3 Searching algorithms · 3.1.4 Sorting algorithms
- Introduction to Problem Solving – Problem solving on a computer has stages: analyse the problem (inputs, outputs, rules), develop an algorithm (a finite, clear, ordered set of steps), code it in a programming language, test it with different inputs, and debug (find and remove errors). An algorithm can be shown as a flowchart (oval = start/stop, parallelogram = input/output, rectangle = process, diamond = decision, arrows = flow) or as pseudocode (structured plain English). Decomposition breaks a big problem into smaller sub-problems that are solved separately and then joined.
- Algorithm Complexity: How Fast Does an Algorithm Grow? – Many algorithms can solve the same problem, but some need far more steps. We measure an algorithm by counting its basic steps as the input size n grows, not by stopwatch seconds. Big O notation names the growth: O(1) constant, O(log n) logarithmic, O(n) linear, O(n log n), and O(n²) quadratic. Linear search is O(n), binary search is O(log n); bubble sort is O(n²), merge sort is O(n log n). Memory used is space complexity.
- Searching and Sorting Algorithms – A searching algorithm finds an item in a list; a sorting algorithm puts a list in order. Linear search checks items one by one and works on any list. Binary search halves a sorted list each time and is much faster. Bubble sort swaps neighbours pass by pass; merge sort splits the list and merges sorted halves, which is faster for big lists.
- Sorting Algorithms – A sorting algorithm puts a list in order. Bubble sort swaps neighbours, insertion sort slides each item into a sorted part, selection sort picks the smallest each time, and merge sort splits the list and merges sorted halves. Merge sort needs far fewer comparisons on long lists (about n log₂ n instead of about n²/2).
2. 3.2 Programming
3.2.1 Data types · 3.2.2 Programming concepts · 3.2.3-3.2.5 Arithmetic, relational and Boolean operations · 3.2.6 Data structures · 3.2.7-3.2.9 Input/output, strings, random numbers · 3.2.10 Structured programming and subroutines · 3.2.11 Robust and secure programming
- Programming Basics: Sequence, Selection, Loops and Functions – A program is a set of exact instructions a computer follows. Every program is built from three structures: sequence (steps in order), selection (if/else choices) and iteration (loops). Variables store values. Functions group code into reusable, named blocks, which makes programs modular and easier to test, debug and maintain.
- Control Flow: Sequence, Selection and Iteration – A program is a list of instructions. Control flow is the order in which they run. There are only three building blocks: sequence (one after another), selection (IF: pick one path) and iteration (loops: repeat). Loops are definite (FOR: count known) or indefinite (WHILE / REPEAT UNTIL: stop when a condition changes). Blocks can sit inside each other (nesting). Values are kept in variables (can change) and constants (fixed), each with a clear, meaningful name.
- Arrays and Lists: Storing Many Values in One Name – An array is a row of numbered boxes that share one name. Each box holds one value and has an index that starts at 0. We read or change a box with its index, visit every box with a loop (traversal), and use that loop for standard algorithms: sum, average, largest, count and linear search. A 2D array is a grid of rows and columns, read with two indexes and two nested loops. A fixed array has a set length; a list (Python list, Java ArrayList) can grow and shrink.
- Strings in Python – A string is an immutable sequence of characters written in single, double or triple quotes. Each character has a positive index (0 from the left) and a negative index (−1 from the right). Operations: + (concatenation), * (repetition), in / not in (membership) and slicing s[start:stop:step], which takes characters from start up to but not including stop. Traversal means visiting each character with a for or while loop. Built-in methods like len(), upper(), lower(), title(), capitalize(), count(), find(), index(), replace(), split(), join(), strip(), startswith(), endswith(), isalpha(), isdigit(), isalnum(), islower(), isupper() and isspace() return new values without changing the original string.
- Functions in Python: Build Your Own Machines – A function is a named block of code that does one job. Python has built-in functions (print, len), functions inside modules (math.sqrt, random.randint) and user-defined functions you write with def. Values sent in a call are arguments; the names that receive them are parameters. Arguments can be positional, keyword or use default values. return sends a value back. Python runs code top to bottom, jumps into a function when it is called and comes back after it. Names made inside a function are local; names made outside are global.
- Software Development: From Idea to Working App – Good software is built in stages: analyse the problem and write requirements, design the solution, code it in small parts, test it with normal, boundary and erroneous data, deploy it to users and maintain it. Waterfall does each stage once in order; agile repeats short cycles. Robust programs validate input, and teams use version control, clear roles and feedback from users.
3. 3.3 Fundamentals of data representation
3.3.1-3.3.2 Number bases and conversion · 3.3.3 Units of information · 3.3.4 Binary arithmetic · 3.3.5 Character encoding · 3.3.6 Representing images · 3.3.7 Representing sound · 3.3.8 Data compression
- Number Systems and Encoding – A number system is a way to write numbers using a set of digits and a base. Decimal (base 10) uses 0–9, binary (base 2) uses 0 and 1, octal (base 8) uses 0–7, and hexadecimal (base 16) uses 0–9 and A–F. To go from decimal to any base, divide repeatedly by the base and read remainders bottom to top; for fractions, multiply by the base and read the integer parts top to bottom. To go to decimal, multiply each digit by its place value and add. Binary ↔ octal uses groups of 3 bits, binary ↔ hex groups of 4. Text is stored with encoding schemes: ASCII (7-bit, 128 characters), ISCII (8-bit, Indian scripts) and Unicode (every script), stored as UTF-8 (1–4 bytes) or UTF-32 (4 bytes).
- Data Representation: How Computers Store Numbers, Text, Images and Sound – Data is raw facts; information is data given meaning; knowledge is information we can use. A computer stores all data as bits (0 or 1). 8 bits make a byte, and 1 kB = 1000 bytes, 1 MB = 1000 kB, 1 GB = 1000 MB, 1 TB = 1000 GB. Numbers are stored in binary, where place values double: 1, 2, 4, 8 and so on. Text uses a character set: in ASCII 'A' is 65; Unicode covers every script. A bitmap image is a grid of pixels; size = width × height × colour depth. Sound is sampled: size = sample rate × bit depth × seconds. Vector images store shapes instead of pixels. Compression makes files smaller: lossless keeps every bit, lossy throws some detail away.
- Digital Media: How Pictures, Sound and Video Become Numbers – Digital media is any picture, sound, video or animation stored as numbers on a computer. A raster image is a grid of pixels, each stored as red, green and blue values from 0 to 255. Vector graphics store shapes as maths, so they stay sharp at any size. Video and animation are many frames shown quickly. File size grows with resolution and colour depth, so we use compression. When we make or share media we must respect copyright, licences and people's image rights, and work safely and critically.