Lesson 1 · Data structures

🥞 Stacks, Queues & Linked Lists

Choosing the right way to organise data decides how easily a program can use it. Stacks, queues and linked lists each suit different jobs.

📚 Stacks and queues

A stack is last-in, first-out (LIFO): push adds to the top, pop removes the top. A queue is first-in, first-out (FIFO): enqueue adds to the back, dequeue removes from the front.

stack: push 4, push 7, push 2, pop → 2, pop → 7 (4 left) queue: enqueue 4, 7, 2, dequeue → 4, dequeue → 7 (2 left) undo button = stack print jobs = queue

🖼️ See it

Stack compared with queueStack (LIFO)Last in, first outpush and pop at the topUndo history, call stackQueue (FIFO)First in, first outenqueue at back, dequeue at frontPrint jobs, waiting lists

🔗 Linked lists

A linked list is a chain of nodes, each holding a value and a pointer to the next node. Inserting in the middle only changes pointers, but finding the nth item means following n pointers.

head → [3] → [8] → [5] → null length = 3; to reach the 3rd node follow 2 pointers array: access O(1), insert in middle O(n) linked list: access O(n), insert after a node O(1)
Pick by usage: frequent random access suggests an array, frequent insertions suggest a linked list.
✏️ Quick check · 1 of 7
LIFO

A stack is:

Plates.
✏️ Quick check · 2 of 7
Queue use

Which situation is best modelled by a queue?

Fair order.
✍️ Type your answer · 3 of 7

Stack: push 4, push 7, push 2, then pop once.

What value is popped?

Enter an exact answer, without rounding.
LIFO.
✍️ Type your answer · 4 of 7

After push 4, 7, 2 and two pops, one item is left.

What is it?

Enter an exact answer, without rounding.
Follow the pops.
✍️ Type your answer · 5 of 7

Queue: enqueue 4, 7, 2, then dequeue once.

What value is removed?

Enter an exact answer, without rounding.
FIFO.
✍️ Type your answer · 6 of 7

A linked list has 5 nodes. To reach the last node from the head you follow pointers.

How many pointers are followed?

Enter an exact answer, without rounding.
One fewer than the node number.
✍️ Type your answer · 7 of 7

A stack holds 6 items and 2 pops and 1 push happen.

How many items does it hold now?

Enter an exact answer, without rounding.
Follow the changes.
📝 Lesson quiz · 5 questions
0 / 5
Re-read the lesson, then give it another go.
Question 1 of 5

Which operation adds to a stack?

Question 2 of 5

A pointer in a linked list holds:

Question 3 of 5

Which structure has O(1) access by index?

Question 4 of 5

A circular queue is useful because:

Question 5 of 5

Peek on a stack:

Lesson 2 · Data structures

🌳 Trees & Graphs

Trees and graphs describe relationships: file folders, family trees, maps and social networks. Traversal algorithms visit every node in a systematic order.

🌲 Binary trees

A binary tree has nodes with at most two children. In a binary search tree the left subtree holds smaller values and the right holds larger. Searching takes about the height of the tree.

insert 8, 3, 10, 1, 6, 14: 8 3 10 1 6 14 in-order traversal (left, node, right): 1, 3, 6, 8, 10, 14 6 nodes, height 3; a full tree of height h has 2ʰ − 1 nodes: h = 3 → 7

🖼️ See it

Adjacency matrix of a graphABCDA0110B1010C1101D0010
For the graph with edges A–B, A–C, B–C and C–D, a 1 means two nodes are joined. The matrix is symmetric because the edges have no direction.

🗺️ Graphs and traversal

A graph has nodes (vertices) joined by edges. Breadth-first search (BFS) explores level by level using a queue, and depth-first search (DFS) goes deep first using a stack.

A–B, A–C, B–D, C–D, D–E BFS from A: A, B, C, D, E shortest path A → E: A–B–D–E (3 edges) edges in a complete graph of n nodes: n(n − 1)/2 n = 5 → 10 edges
BFS finds the fewest-edges path in an unweighted graph.
✏️ Quick check · 1 of 7
BST rule

In a binary search tree, values in the left subtree are:

Left is less.
✏️ Quick check · 2 of 7
BFS

Breadth-first search uses which structure?

FIFO.
✍️ Type your answer · 3 of 7

A BST is built by inserting 8, 3, 10, 1, 6, 14.

What is the first value in an in-order traversal?

Enter an exact answer, without rounding.
Smallest first.
✍️ Type your answer · 4 of 7

The same tree is traversed in-order.

What is the 4th value?

Enter an exact answer, without rounding.
Fourth in sorted order.
✍️ Type your answer · 5 of 7

A full binary tree has height 3.

How many nodes does it have (2ʰ − 1)?

Enter an exact answer, without rounding.
Use the formula.
✍️ Type your answer · 6 of 7

A complete graph has 5 nodes where every pair is joined.

How many edges does it have?

Enter an exact answer, without rounding.
n(n − 1)/2.
✍️ Type your answer · 7 of 7

A–B, A–C, B–D, C–D and D–E are the edges.

How many edges are on the shortest path from A to E?

Enter an exact answer, without rounding.
Find the shortest route.
📝 Lesson quiz · 5 questions
0 / 5
Re-read the lesson, then give it another go.
Question 1 of 5

A leaf node is one that:

Question 2 of 5

The root of a tree is:

Question 3 of 5

Which is a weighted graph example?

Question 4 of 5

Depth-first search is naturally written using:

Question 5 of 5

A directed graph has edges that:

Lesson 3 · Algorithms

🔎 Searching, Sorting & Dijkstra

With larger data, algorithm choice matters. Merge sort, binary search and shortest-path algorithms are the workhorses of real software.

⚡ Faster sorting

Merge sort and quicksort are O(n log n) on average. Merge sort always splits in halves; quicksort partitions around a pivot.

n = 1024 items bubble sort ≈ n² = 1 048 576 steps merge sort ≈ n·log₂ n = 1024 · 10 = 10 240 steps quicksort [3, 6, 1, 8, 2] pivot 3: smaller [1, 2], pivot 3, larger [6, 8]

🖼️ See it

Linear search compared with binary search016324864016324864linear: nbinary: log₂ n + 17 steps for 64 itemsitems in the listcomparisons in the worst case
Binary search halves the list each time, so it needs only about 7 steps for 64 sorted items, where linear search may need all 64.

🛣️ Dijkstra’s shortest path

Dijkstra’s algorithm finds the cheapest route in a weighted graph. It repeatedly picks the unvisited node with the smallest known distance and updates its neighbours.

A–B 4, A–C 1, C–B 2, B–D 5, C–D 8 start A: A=0, C=1, B=min(4, 1+2)=3, D=min(1+8, 3+5)=8 shortest A → D = 8 (A–C–B–D) A → B = 3
Dijkstra needs non-negative weights.
✏️ Quick check · 1 of 7
Quicksort pivot

In quicksort, the pivot is used to:

Partition.
✏️ Quick check · 2 of 7
Dijkstra

Dijkstra’s algorithm finds:

Cheapest route.
✍️ Type your answer · 3 of 7

A list of 1024 items is sorted with merge sort (n·log₂ n steps).

About how many steps are needed?

Enter an exact answer, without rounding.
log₂ 1024 = 10.
✍️ Type your answer · 4 of 7

Bubble sort needs about n² steps for n = 1024.

How many steps?

Enter an exact answer, without rounding.
Square it.
✍️ Type your answer · 5 of 7

Quicksort [3, 6, 1, 8, 2] with pivot 3.

How many items go into the “smaller” group?

Enter an exact answer, without rounding.
Count items below 3.
✍️ Type your answer · 6 of 7

Edges: A–B 4, A–C 1, C–B 2, B–D 5, C–D 8.

What is the shortest distance from A to B?

Enter an exact answer, without rounding.
Try via C.
✍️ Type your answer · 7 of 7

Using the same graph, what is the shortest distance from A to D?

Give the distance.

Enter an exact answer, without rounding.
Compare routes.
📝 Lesson quiz · 5 questions
0 / 5
Re-read the lesson, then give it another go.
Question 1 of 5

Merge sort has complexity:

Question 2 of 5

A heuristic algorithm like A* uses:

Question 3 of 5

Which sort is stable and guaranteed O(n log n)?

Question 4 of 5

A greedy algorithm:

Question 5 of 5

Binary search on 1 000 000 sorted items needs about:

Lesson 4 · Networks

🌐 Networking & IP Addressing

The internet’s layers and protocols let billions of devices exchange data reliably. IP addressing decides where each packet goes.

🧅 Layers and protocols

The TCP/IP model has four layers: application (HTTP, DNS, SMTP), transport (TCP is reliable, UDP is fast), internet (IP, routing) and link (Ethernet, Wi-Fi). Each layer adds a header to the data.

TCP: connection, order, resend lost packets → web pages, email UDP: no checks, low delay → video calls, games HTTP 200 = OK, 404 = not found, 500 = server error

🖼️ See it

Network and host parts of an IPv4 addressOctet 1Octet 2Octet 3Octet 4Address192168120Subnet mask2552552550Partnetworknetworknetworkhost
Where the mask has 255, those bits identify the network (192.168.1.0/24). The remaining octet identifies the device, so up to 254 hosts fit.

🔢 IP addresses and subnets

An IPv4 address has 32 bits written as four numbers 0–255. A subnet mask (such as /24) shows how many bits identify the network; the rest identify hosts. Two host addresses are reserved (network and broadcast).

IPv4: 32 bits → 2³² = 4 294 967 296 addresses /24: host bits = 32 − 24 = 8 → 2⁸ − 2 = 254 hosts /26: host bits = 6 → 2⁶ − 2 = 62 hosts 192.168.1.10 in binary first octet: 1100 0000 = 192 IPv6 has 128 bits
Private ranges (192.168.x.x, 10.x.x.x) are used inside networks and translated by NAT.
✏️ Quick check · 1 of 7
TCP vs UDP

Which protocol is more suitable for a live video call?

Speed over reliability.
✏️ Quick check · 2 of 7
404

The HTTP status code 404 means:

Not found.
✍️ Type your answer · 3 of 7

An IPv4 address has 4 numbers, each stored in 8 bits.

How many bits is the whole address?

Enter an exact answer, without rounding.
Multiply.
✍️ Type your answer · 4 of 7

A /24 network uses 24 bits for the network.

How many bits are left for hosts?

Enter an exact answer, without rounding.
Subtract from 32.
✍️ Type your answer · 5 of 7

A /24 network has 8 host bits (2 addresses reserved).

How many usable hosts are there?

Enter an exact answer, without rounding.
Remove network and broadcast.
✍️ Type your answer · 6 of 7

A /26 network has 6 host bits.

How many usable hosts are there?

Enter an exact answer, without rounding.
64 − 2.
✍️ Type your answer · 7 of 7

The binary number 1100 0000 is the first octet of 192.168.1.10.

What is its decimal value?

Enter an exact answer, without rounding.
Two bits are on.
📝 Lesson quiz · 5 questions
0 / 5
Re-read the lesson, then give it another go.
Question 1 of 5

DNS resolves:

Question 2 of 5

Which layer does IP belong to?

Question 3 of 5

A port number identifies:

Question 4 of 5

NAT lets:

Question 5 of 5

HTTPS uses which protocol to encrypt?

Lesson 5 · Data

🧮 Relational Databases

Real databases split data into related tables to avoid repeating it. Joins bring the tables back together when you query.

🔑 Keys and normalisation

A foreign key in one table refers to the primary key in another, which makes a relationship. Normalisation removes repeated data so each fact is stored once.

students(id, name) classes(id, student_id, subject) 1 Aisha 1 1 Math 2 Ben 2 1 Art 3 2 Math student_id is a foreign key into students Aisha has 2 classes, Ben has 1

🖼️ See it

A foreign key links two tablesorder_idcustomer_iditem1011Book1022Pen1031Bag
The highlighted customer_id is a foreign key: it matches the primary key id in the Customers table, so customer details are stored only once.

🔗 JOIN and aggregate

JOIN combines rows from two tables where the keys match. GROUP BY with COUNT, SUM or AVG summarises each group.

SELECT name, subject FROM students JOIN classes ON students.id = classes.student_id → 3 rows (Aisha–Math, Aisha–Art, Ben–Math) SELECT subject, COUNT(*) FROM classes GROUP BY subject → Math 2, Art 1 SELECT SUM(price) → 12 + 8 + 5 = 25
Use parameterised queries in programs to prevent SQL injection.
✏️ Quick check · 1 of 7
Foreign key

A foreign key:

Link.
✏️ Quick check · 2 of 7
Normalisation

The purpose of normalisation is to:

Less repetition.
✏️ Quick check · 3 of 7
SQL injection

SQL injection is prevented by:

Separate data from code.
✍️ Type your answer · 4 of 7

The classes table lists: Aisha-Math, Aisha-Art, Ben-Math.

How many rows does the join return?

Enter an exact answer, without rounding.
Count class rows.
✍️ Type your answer · 5 of 7

SELECT subject, COUNT(*) FROM classes GROUP BY subject, with Math twice and Art once.

What is the count for Math?

Enter an exact answer, without rounding.
Count Math rows.
✍️ Type your answer · 6 of 7

A sales table has prices 12, 8 and 5.

What does SELECT SUM(price) return?

Enter an exact answer, without rounding.
Add.
✍️ Type your answer · 7 of 7

A table has 1000 rows and a query keeps those where price > 5. 250 rows match.

What percentage of rows is returned?

Enter an exact answer, without rounding.
%
Part ÷ whole.
📝 Lesson quiz · 5 questions
0 / 5
Re-read the lesson, then give it another go.
Question 1 of 5

A JOIN combines:

Question 2 of 5

Which field is best as a primary key?

Question 3 of 5

GROUP BY is used to:

Question 4 of 5

Which is NOT a benefit of a relational database?

Question 5 of 5

A one-to-many relationship example is:

Lesson 6 · Engineering

🧪 Software Development & Testing

Writing code is only part of building software. Planning, testing, and working with others turn a program into a reliable product.

🏗️ The development cycle

Typical stages: analysis (what is needed), design, implementation, testing and maintenance. Waterfall follows them in order; agile works in short cycles (sprints) with frequent feedback.

agile sprint: 2 weeks 6 sprints = 12 weeks version control (git) records every change: commit → branch → merge

🖼️ See it

The software development life cycle📝Plan📐Design⌨️Code🧪Test🚀ReleaseRepeat
Developers cycle through these stages. Testing finds faults early, when they are cheapest to fix.

✅ Testing

Use test data of three kinds: normal, boundary (the edges) and erroneous (invalid). Unit tests check one function; integration tests check parts working together.

validate age 13–19 (inclusive) normal: 15 boundary: 13, 19, 12, 20 erroneous: "abc", -4 function add(a, b) expected add(2, 3) = 5 test cases for a range: 2 boundaries × 2 sides = 4 boundary tests
Write a test for every bug you fix so it never comes back.
✏️ Quick check · 1 of 7
Agile

Agile development works by:

Iterations.
✏️ Quick check · 2 of 7
Boundary data

For input that must be 13 to 19, which is boundary test data?

On the edge.
✏️ Quick check · 3 of 7
Unit test

A unit test checks:

One unit.
✍️ Type your answer · 4 of 7

A project uses 2-week sprints.

How many weeks do 6 sprints take?

Enter an exact answer, without rounding.
Multiply.
✍️ Type your answer · 5 of 7

A valid age range is 13 to 19 inclusive. Boundary values to test are 12, 13, 19 and 20.

How many boundary tests is that?

Enter an exact answer, without rounding.
Count them.
✍️ Type your answer · 6 of 7

A function add(a, b) is tested with add(2, 3).

What result is expected?

Enter an exact answer, without rounding.
The expected value.
✍️ Type your answer · 7 of 7

A test suite has 40 tests and 38 pass.

What percentage pass?

Enter an exact answer, without rounding.
%
Part ÷ whole.
📝 Lesson quiz · 5 questions
0 / 5
Re-read the lesson, then give it another go.
Question 1 of 5

Which is erroneous test data for an age field?

Question 2 of 5

Version control is used to:

Question 3 of 5

Debugging means:

Question 4 of 5

Maintenance includes:

Question 5 of 5

A prototype is:

Final Challenge

🏆 12-Question Challenge Quiz

Questions from every topic in this course. Pick an answer for each one, then hit Check My Answers.

0 / 12
💪 Keep practicing — go back through the lessons and retake the quiz!
Q1 · Stacks, Queues & Linked Lists

Which data structure is used to track function calls?

Q2 · Stacks, Queues & Linked Lists

Peek on a stack:

Q3 · Trees & Graphs

Which traversal of a BST visits values in sorted order?

Q4 · Trees & Graphs

A directed graph has edges that:

Q5 · Searching, Sorting & Dijkstra

Which pair is faster for large n?

Q6 · Searching, Sorting & Dijkstra

Binary search on 1 000 000 sorted items needs about:

Q7 · Networking & IP Addressing

Which protocol assigns IP addresses automatically?

Q8 · Networking & IP Addressing

HTTPS uses which protocol to encrypt?

Q9 · Relational Databases

SELECT … WHERE price > 5 AND qty = 2 requires:

Q10 · Relational Databases

A one-to-many relationship example is:

Q11 · Software Development & Testing

Which stage comes immediately before testing in the waterfall model?

Q12 · Software Development & Testing

A prototype is: