Practice Flashcards
Flip to reveal answersWhat is the difference between a static and a dynamic data structure?
Track your progress — Sign up free to save your progress and get smart review reminders based on spaced repetition.
All 5 Flashcards — Static vs dynamic structures
Sign up free to track progress and get spaced-repetition review schedules.
Question
What is the difference between a static and a dynamic data structure?
Answer
A static structure has its size fixed when it is created, in one contiguous block of memory. A dynamic structure grows and shrinks while the program runs, taking more memory only when it needs it.
Question
Why is reading a position in a static array fast?
Answer
Everything sits in one block with items of equal size, so the address of item 20 is simply the start plus twenty item-widths. It is one calculation, with nothing searched for — O(1).
Question
What does a dynamic structure cost when it grows?
Answer
When it outgrows its block it must claim a bigger one and copy everything across. That single operation is expensive, but it happens rarely, so the average cost of adding an item stays low.
Question
When should you choose a static structure?
Answer
When the size is genuinely fixed — twelve months, seven days, sixty-four squares — or when a very large amount of data is scanned repeatedly and both speed and predictable memory matter.
Question
Why is a fixed-size array wrong for an unknown number of items?
Answer
You must guess a maximum. Guess too small and it overflows or silently discards data; guess too large and most of the memory is never used — with still no guarantee the guess was enough.
Read the notes
Full study notes for Static vs dynamic structures
Topic 6.2 hub
Data structures
More from Topic 6.2
All flashcards in this topic
Computer Science exam skills
Paper structures & tips
Track your progress with spaced repetition
Sign up free — Aimnova tells you exactly which cards to review and when, so you remember everything before your IB exam.
Start Free