aimnova.
DashboardMy LearningPaper MasteryStudy Plan

Aimnova site navigation

Stay in the loop

Get the latest study resources and updates

New features, study tips and exam insights — straight to your inbox.

IB Diploma

  • IB Past Papers
  • IB Study Notes
  • IB Question Bank
  • IB Mock Exams
  • IB Revision

IB Subjects

  • IB Math AA
  • IB Math AI
  • IB Economics
  • IB Business Management
  • IB Physics
  • IB Biology
  • View all IB subjects→

IB Past Papers

  • IB Math AA HL Past Papers
  • IB Math AA SL Past Papers
  • IB Math AI HL Past Papers
  • IB Math AI SL Past Papers
  • IB Economics HL Past Papers
  • IB Economics SL Past Papers
  • IB ESS Past Papers
  • View all past papers→

Study Resources

  • Study Notes
  • Question Bank
  • Mock Exams
  • Flashcards
  • Revision Guide
  • Exam Skills
  • Command Terms
  • Grade Calculator
  • Exam Timetable 2026

Aimnova

  • Features
  • Pricing
  • For Schools
  • For Parents
  • About Us
  • Blog
  • Contact
aimnova.

AI-powered study platform for smarter revision, past-paper analysis and examiner-style feedback.

TermsPrivacyCookies·© 2026 Aimnova. All rights reserved.8afc4e3

Aimnova is not affiliated with or endorsed by the International Baccalaureate Organization (IB).

NotesComputer Science HLTopic 6.2
Unit 6 · Programming · Topic 6.2

IB Computer Science HL — Data structures

Data structures

Higher Level students should use this topic hub as a map: start with the shared sub-topics, then follow the HL-only extensions and exam-skill links where this topic asks for deeper analysis.

Exam technique guidePractice questions

Key concepts in Data structures

Key Idea: A data structure is chosen for the operations it makes cheap. Direct access, insertion in the middle, and order of removal pull in different directions — so the right answer depends entirely on what the program does most.

Paper 1

  • Short definitions and a trace.
  • State, identify, outline — precise terms.

Paper 2

  • Write or correct Python for a scenario — your paper is the Python version, option B.
  • Construct, determine, suggest.

Both

  • Trace tables and justified choices earn method marks even when the final answer slips.

📦 Static against dynamic

Array (static)Linked list (dynamic)
SizeFixed at creationGrows and shrinks with the data
Access by indexOne calculationFollow n references
Insert in the middleShift everything after itChange two references
Memory per itemJust the valueValue plus a reference
An array of n elements has n valid positions: 0 to n − 1 counting from zero. Reading index n is the classic out-of-bounds error — and in some languages it silently reads someone else's memory rather than failing.

🥞 Stack and queue

Stack (LIFO)Queue (FIFO)
Add and removeThe same endRear in, front out
Order outLast in, first outFirst in, first out
Used forUndo, back button, function callsPrint jobs, server requests
Its pointReverse the most recentFairness — nobody is overtaken

The details that get asked

  • Overflow is pushing onto a full stack; underflow is popping an empty one
  • Each function call pushes a frame holding locals and the return address
  • Recursion with no base case exhausts that stack — a stack overflow
  • A simple array queue wastes the space freed at the front; a circular queue wraps using a remainder
  • A priority queue serves by urgency, so low-priority items can starve unless priorities age
Important: The change to reverse is the most recent one. A queue would undo the oldest change first, leaving the document in a state it was never in.

📝 Exam-style questions

IB-style questionDetermine[4 marks]

A stack is empty. The operations PUSH 7, PUSH 2, POP, PUSH 9, PUSH 4, POP, PUSH 1 are carried out. Determine the contents of the stack, top first.

🔒 Model answer plan

See the mark-by-mark plan — for / against / judgement, with marking guidance — in study mode.

Claim your free topic →
IB-style questionSuggest[3 marks]

A hospital triage system holds patients waiting to be seen. Suggest a suitable data structure, justifying your choice and identifying one problem it creates.

🔒 Model answer plan

See the mark-by-mark plan — for / against / judgement, with marking guidance — in study mode.

Claim your free topic →

✅ Quick check

Cover the answers.

Why is undo a stack rather than a queue? The change to reverse is the most recent — LIFO. A queue would undo the oldest first.

Where is the valid index range of an array of n elements? 0 to n − 1 counting from zero. Index n is out of bounds.

What causes a stack overflow in recursion? No base case — every call pushes a frame and none ever returns, until the call stack is exhausted.

Why does a dynamic array double rather than grow by one? Growing by one copies about n² elements in total; doubling makes the average cost per insertion constant.

What is starvation in a priority queue? A low-priority item is overtaken indefinitely. Fixed by ageing — raising priority with waiting time.


Exam tips

  • Redraw the structure after EVERY operation, with the top or front labelled.
  • Check pushes minus pops against the number of items left.
  • Array for fixed size and index access; linked list for frequent insertion and removal.
  • Say WHY the order matters — LIFO for reversal, FIFO for fairness.
  • Overflow is a full stack, underflow an empty one. Do not swap them.
  • Naming a structure earns one mark; the justification earns the rest.

What you'll learn in Topic 6.2

  • 6.2.1 Static vs dynamic structures
  • 6.2.2 Arrays and lists
  • 6.2.3 Stacks (LIFO)
  • 6.2.4 Queues (FIFO)
Suggested study order: Read the notes for each sub-topic below → test yourself with flashcards → attempt practice questions → review exam technique.

Study resources — 6.2 Data structures

6.2.1

Static vs dynamic structures

Notes
6.2.2

Arrays and lists

Notes
6.2.3

Stacks (LIFO)

Notes
6.2.4

Queues (FIFO)

Notes

Ready to study Data structures?

Get expert practice questions with instant AI feedback, and a study planner tailored to your IB Computer Science HL exam date.

Start studying free

Topic 6.2 Data structures forms a core part of Unit 6: Programming in IB Computer Science HL. Mastering these concepts will strengthen your understanding of connected topics across the syllabus and prepare you for exam questions that require analysis, evaluation, and real-world application.

Previous topic
6.1 Programming fundamentals
Next topic
6.3 Programming constructs
All Computer Science HL topics
Exam technique

Ready to practice?

Get AI-graded practice questions, mock exams, flashcards, and a personalised study plan — all aligned to your IB syllabus.

Start Studying Free

No credit card required · No time limit