levo

Fundamentals of Data Structures

Static and Dynamic Data Structures

  • 2 things to know
  • Paper 1
Start revising · £5/month

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.

Your recallNot started
Evaluation

Give two advantages of a dynamic data structure.

Key term

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. 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. 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. 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. 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. 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. 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.

Everything in your subscription

Runs, plus a mode for every other kind of session.

1Flash
2Imposter
3Fade
4Brain dump

Learn every subtopic in runs of four questions

Facts flash and fade, a wrong word hides in some of them, and a brain dump decides which questions are locked in.

Fundamentals of Programming
Fundamentals of Data Structures
Fundamentals of Algorithms
Theory of Computation

Cram the night before, weakest topic first

A quick scan finds your weakest topics. Recall each fact you missed three times in a row.

A driver is .
softwarehardwarestorage

Blank Blitz consolidates the facts

Rapid timed gap-fills on the terms and numbers you need to recall without thinking.

✓What it iscovered
~Why it happenspartly there
How long it lastsnot there yet

Explain It tests your understanding

Explain a concept in your own words and see which of its points you covered.

Head means the first single element of a non-empty list.
TrueFalse

Test It catches misconceptions

Spot the fault in a statement. The faults are the mistakes students make most often.

721941163128510

Brain Breaks between sessions

Short focus games to reset attention, so the next set lands better than the last.

Every question in Fundamentals of Data Structures, on a schedule.

Learn it in runs of four questions, each ending on a brain dump against the clock. Every question you lock in comes back the next day, then at longer gaps, each time just before you would forget it.

Or £46 a year, about £3.83 a month. Cancel anytime.