Data Structures

IB Syllabus: B2.2 - Data structures


Overview

Every program needs to store collections of data. This section covers fundamental data structures – from simple arrays to abstract structures like stacks and queues.

# Topic Syllabus Key Concepts Level
1 1D Arrays B2.2.2 Static structure; fixed size, direct index access SL + HL
2 2D Arrays B2.2.2 Static structure; rows and columns (grid/table) SL + HL
3 ArrayList B2.2.2 Dynamic structure; grows and shrinks automatically SL + HL
4 Stacks B2.2.3 Abstract structure; Last In, First Out (LIFO) SL + HL
5 Queues B2.2.4 Abstract structure; First In, First Out (FIFO) SL + HL

Sub-pages with full worked examples, quizzes, and exercises are being built out. 2D Arrays is the first complete sub-page - the rest will follow soon.


Choosing the Right Structure

Situation Best choice
Fixed number of items, fast index access Array
Number of items changes at runtime ArrayList
Need LIFO (undo, backtracking) Stack
Need FIFO (order matters, job queue) Queue
Tabular data (grid, board, matrix) 2D Array

Static vs Dynamic Structures

Feature Static (Array) Dynamic (ArrayList, Stack, Queue)
Size Fixed at creation Grows or shrinks at runtime
Memory Allocated once Allocated as needed
Access Direct by index Depends on type
Speed Very fast Slight overhead

The key insight: static structures are simpler and faster when you know the size in advance. Dynamic structures are necessary when size changes at runtime.


Table of contents


© EduCS.me — A resource hub for Computer Science education

This site uses Just the Docs, a documentation theme for Jekyll.