/en-tutor-prep-s6-term1-ict-data-structures-tracing/
/en-tutor-prep-s6-term1-ict-data-structures-tracing/
General Inquiry: info@TutorZone.com.hk
Office Hours: Monday to Saturday - 9:00 AM to 6:00 PM
WhatsApp Monday to Sunday - 24 hours
Hotline: +852 6828 1809
Instant Support: +852 9061 3106

S6 Term 1 | ICT: Data Structures and Program Tracing – Stacks, Queues, Linked Lists, Postfix and Binary Search | Tutor Lesson Plan | 45-minute flow, teaching script, common errors, practice with answers

S6 Term 1 | ICT: Data Structures and Program Tracing – Stacks, Queues, Linked Lists, Postfix and Binary Search | Tutor Lesson Plan | 45-minute flow, teaching script, common errors, practice with answers

  • 2026-12-05

Tutor lesson plan · S6 Term 1 ICT

Data structure questions are not vocabulary tests: they ask for the intermediate state at every step. This lesson fixes one traceable set of steps for stacks, queues, linked lists and binary search, so every later tracing question is filled in the same table.

Lesson objectives By the end students can: (1) state that a stack is last in first out and a queue first in first out, and trace six operations to a stack of [3, 7] with 7 on top; (2) evaluate the postfix string 6 2 3 * – 4 2 / + with a stack, writing each intermediate value and reaching 2; (3) show that binary search takes 10 steps on 1,024 items against 512 for linear search, a factor of 51, and that inserting at a linked-list head changes only 2 pointers.

01 Prior knowledge check (first 3 minutes)

If any item below is not secure, fix it before this lesson:

Skill Quick check Pass standard
Skill: powers of two What is 2 to the tenth power 1,024; otherwise learn the powers first
Skill: pointers How many parts does a node need to reach the next node The data and one next pointer
Skill: operator order In 6 2 3 * which step comes first The star multiplies the two nearest values

02 Lesson flow (45 minutes)

Time Stage Tutor does Student does
0-5 min Diagnose Ask which end a stack and a queue take from; write last in first out and first in first out Answers orally with one example each
5-14 min Six stack steps Trace push 3, push 7, push 5, pop, push 1, pop and write the whole stack each time Fills the six cells and finds the top is 7
14-23 min Postfix evaluation Evaluate 6 2 3 * – 4 2 / + with the same stack Writes each intermediate value and ends at 2
23-31 min Queue and linked list Two dequeues then enqueue F, G, H give front C, rear H and length 6; a head insert changes 2 pointers Draws six cells and counts the pointer changes
31-40 min Binary search Halving 1,024 gives 10 steps; linear averages 512, a factor of 51 Counts the halvings itself
40-45 min Exit check Collect three items and note the failure type Answers without notes

03 Teaching script (read it aloud)

Act 1: the stack and where its top is

A stack has one opening, so every operation happens at the top and the last item in is the first out. Write all six steps: push 3 gives [3]; push 7 gives [3, 7]; push 5 gives [3, 7, 5]; pop removes 5 and leaves [3, 7]; push 1 gives [3, 7, 1]; the last pop removes 1 and leaves [3, 7]. The final size is 2 and the top is 7. If the array holds 8 items, a ninth push overflows, so the question whether another push fits is answered by capacity, not by the current size.

Most common misconception: thinking pop takes the bottom item or clears the stack. Pop removes exactly one item, the top one.

Ask the student to repeat: “Three pushes, one pop, one push, one pop leave [3, 7] with 7 on top.”

Act 2: postfix is a stack in action

Postfix writes each operator after its two operands, so push every number and, on an operator, pop two values, combine them and push the result back. Take 6 2 3 * – 4 2 / +. Read 6, 2 and 3, so the stack is [6, 2, 3]. The star takes 2 and 3 for 6 and the stack becomes [6, 6]. The minus takes 6 and 6 for 0, leaving [0]. Read 4 and 2 for [0, 4, 2]. The slash takes 4 and 2 for 2, leaving [0, 2]. The plus takes 0 and 2 for 2. The answer is 2. Watch the order for minus and divide: the second value popped is the left operand, so reversing them gives -6 instead of 2.

Most common misconception: reversing the two operands. The value popped second is the one written first.

Ask the student to repeat: “Numbers go in, an operator takes two and puts one back, and the last value is the answer.”

Act 3: queues, linked lists and binary search

A queue has two openings: enqueue at the rear and dequeue at the front, so it is first in first out. From [A, B, C, D, E] two dequeues remove A and B for [C, D, E]; three enqueues add F, G and H for [C, D, E, F, G, H], length 6, front C and rear H. A linked list node holds data and one next pointer, so a head insert changes 2 pointers: the new node points at the old head and head points at the new node. Inserting into the middle of a sorted array instead shifts every later element. Binary search halves the range: 1,024 halved ten times reaches 1, so at most 10 comparisons, while linear search averages 512, a factor of 51.

Most common misconception: thinking binary search is always fast. Unsorted data cannot use it, and the cost of sorting must be counted too.

Ask the student to repeat: “Queue is first in first out, front C and rear H; binary search 10 steps against 512, 51 times.”

04 Question types and steps

Type Example Steps Answer
Stack tracing push 3, 7, 5, pop, push 1, pop Write the whole stack each step; pop takes the top Leaves [3, 7], top 7
Postfix evaluation 6 2 3 * – 4 2 / + Numbers in, operator takes two and pushes one 2
Queue operations [A, B, C, D, E], two dequeues, enqueue F, G, H Dequeue moves front, enqueue moves rear Length 6, front C, rear H
Complexity 1,024 items Binary uses log base two; linear uses half 10 against 512, 51 times
Six stack operations leave [3, 7]; postfix gives 2; binary search needs 10 stepsStack: one column per operation, top on the rightpush 33push 737push 5375pop37push 1371pop37top = 7A ninth push overflows an array of 8; pop takes the top, so the last item in is the first out, leaving [3, 7]Queue: A B C D E, two dequeues, then enqueue F G HCDEFGHFront C, rear H, length 6; dequeue moves front only, enqueue moves rear onlyPostfix 6 2 3 * – 4 2 / + gives 26 2 3 in* gives 6– gives 04 2 in/ gives 2+ gives 2Complexity: linear search averages 512 checks on 1,024 items, binary search 10, a factor of 51Inserting at a linked-list head changes two pointers; inserting mid-array shifts the rest, which is how the structure is chosen

Left: six operations stacked one per column; pop takes the top, leaving [3, 7]. Middle: two dequeues then three enqueues give front C and rear H. Bottom: each operator in a postfix string combines the two most recent values; the last value is 2. The comparison shows why 1,024 items call for binary search: 512 checks on average against 10.

Sanity check (must teach):Check the stack by writing every step rather than only the final answer, because one wrong step spoils the rest. Check postfix with two rules: the count of numbers is always one more than the count of operators, and the stack must end with a single value. Check complexity with powers of two: 2 to the tenth is 1,024, so 10 steps, and 9 or 11 is wrong. Check the queue by length: 5 minus 2 plus 3 is 6. When a cell disagrees, look for pop treated as a clear, or the operands of minus reversed.

05 Three independent practice questions

Question Answer What to observe
Push 4, push 9, push 2, pop, push 6, pop, pop: what is left and what is on top? push 4 gives [4]; push 9 gives [4, 9]; push 2 gives [4, 9, 2]; pop leaves [4, 9]; push 6 gives [4, 9, 6]; pop leaves [4, 9]; pop leaves [4]. The stack is [4] with 4 on top. Whether every step is written out
Evaluate the postfix string 5 1 2 + 4 * + 3 -. Push 5, 1 and 2; plus gives 3, so [5, 3]; push 4 and the star gives 12, so [5, 12]; plus gives 17; push 3 and minus gives 14. Whether minus uses the second value first
Binary search on 2,048 sorted items: most comparisons, and the linear average? 2,048 is 2 to the eleventh, so 11 comparisons; linear averages 1,024; the ratio is about 93 times. Whether half of 2,048 or of 1,024 was used

06 Common errors and correction lines

Error Student usually writes Tutor says
Pop treated as a clear “After pop the stack is empty” “Pop removes the top item only; the rest stays.”
Postfix operands reversed “6 2 3 * minus should be 0 minus 6” “The second value popped is written first, so 6 minus 6 is 0.”
Binary steps guessed “About 100 checks for 1,024” “Halve each time: 1,024, 512, 256, 128, 64, 32, 16, 8, 4, 2, 1, so 10.”
Queue length wrong “Two dequeues and three enqueues leave 5” “5 minus 2 plus 3 is 6, front C and rear H.”

07 Homework (paper and question numbers)

08 Exit check (last 3 minutes)

Question Answer Verdict
Which two values remain in the stack after six operations, and which is on top? [3, 7], 7 on top Answering [3, 7, 5] means a pop was missed: reteach act one
What is 6 2 3 * – 4 2 / +? 2 Answering -6 or 6 means the operand order is reversed: reteach act two
How many comparisons does binary search need on 1,024 items? 10 Answering 512 or 100 means halving is not secure: reteach act three

09 Tutor FAQ

Which year is this for?

S6 Term 1 ICT, in the programming and data structures unit. S3 covered flowcharts and arrays; this lesson fixes stacks, queues, linked lists and complexity in one tracing table.

Does 45 minutes cover it?

It covers one trace for each structure plus one complexity comparison. Tree and graph traversal need a separate lesson.

Is there a paper to go with it?

Yes. Homework links to questions 1 to 4 of the S6 ICT paper (set 2), covering the stack, postfix evaluation, the queue and the pointer and search count.

Find a tutor freeTutor sign-up →

©2026 TutorZone · www.tutorzone.com.hk · Terms of use · All rights reserved. Original TutorZone material for personal study and teaching only; not for resale or republication.

Take this guide with you

Reading the full guide is free. Downloading the print version, printing it for students, or taking a whole-level pack needs a tutor account (free).

Registered tutors also get:

Register as a tutor — freeAlready registered? Log in

Join as a tutor or coach — academic, music, sports, arts, STEM. Free to register. See how it works →