levo

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.

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.

What is inside Levo

Six ways to work the same material.

1Closed book
2Open book
3Closed book

The 3-step method, run for you

Answer cold, learn it, then prove it stuck. Levo tracks the jump between your first attempt and your last.

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

Cram a whole paper in one sitting

Sort every topic into what you know and what you do not, then drill only the weak ones.

A driver is .
softwarehardwarestorage

Blank Blitz makes facts automatic

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

AThe integer 5 is 0101.
B0.75 is 1/2 + 1/4.
CThe fraction bits are 1100.

Build It gets the exam shape right

Assemble a full-mark answer from its marking points, in the order an examiner wants them.

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

Test It catches misconceptions

Spot the fault in a statement. The traps are the mistakes students actually make.

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.

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.