AQA A-Level Computer Science 7517
Fundamentals of Programming
Fundamentals of Data Structures
Fundamentals of Algorithms
Theory of Computation
Fundamentals of Data Representation
Fundamentals of Computer Systems
Fundamentals of Computer Organisation and Architecture
Fundamentals of Communication and Networking
Consequences of Uses of Computing
Systematic Approach to Problem Solving
Fundamentals of Databases
Big Data
Fundamentals of Data Structures
Static and Dynamic Data Structures
- 2 things to know
- Paper 1
Overview
Recall questions on the difference between static and dynamic structures and on the advantages and disadvantages of each.
What you need to know
Answer each one before you reveal it.
How can a stack be represented in a language that has no built-in stack type?
Questions from this subtopic
Each one with the model answer underneath.
- 1
What is a static data structure?
Model answer
A data structure whose maximum size is fixed when the program is written or compiled, so the memory it needs is allocated in advance and does not change while the program runs. An array is the usual example.
- 2
What is a dynamic data structure?
Model answer
A data structure that can grow and shrink while the program is running, requesting memory from the heap as new items are added and releasing it as items are removed, so its size is not fixed in advance. A linked list is the usual example.
- 3
Give four advantages of a static data structure.
Model answer
The memory is allocated before the program runs, so there is no time overhead of allocating and deallocating memory during execution. Elements can be accessed directly by index, which is fast, rather than by following pointers. No extra memory is needed to store pointers. It is also simpler to program, with no risk of running out of heap memory or of memory leaks.
- 4
Give two disadvantages of a static data structure.
Model answer
The size cannot change, so if the program needs more items than the structure holds it will overflow and the data cannot be stored. If fewer items are held than the structure allows, the unused memory is wasted and cannot be reclaimed for anything else.
- 5
Give two advantages of a dynamic data structure.
Model answer
It uses only as much memory as it currently needs, so no memory is wasted on unused slots, and memory freed by removing items can be reused elsewhere. It has no fixed upper limit on the number of items, so it can grow to fit the data, limited only by the memory available.
- 6
Give four disadvantages of a dynamic data structure.
Model answer
Extra memory is needed to store the pointers that link the items together. Access is slower because items cannot be reached directly by index — the structure must be traversed by following pointers from the start. Allocating and freeing memory at run time takes time, and there is a risk of the heap becoming exhausted or of memory leaks if freed memory is not released properly. It is also more complex to program.
Other ways to work this
The same content, four other ways.
What is inside Levo
Six ways to work the same material.
Every question in Fundamentals of Data Structures, on a schedule.
Attempt a question from memory, write the correct version, then attempt it again. Levo records the jump between your first attempt and your last, and brings each question back on the day you are due to forget it.
Or £46 a year, about £3.83 a month. Cancel anytime.