14: Data Structures Flashcards
What is meant by a static data structure?
Structure size cannot change at runtime
What is meant by a dynamic data structure?
Structure size can change at runtime
What is meant by an immutable data structure?
Structure/data cannot be changed at runtime
What is meant by a mutable data structure?
Structure/data can be changed at runtime
What is a record?
A collection of related fields. A field is a variable, and each field in a record can have a different data type
What is meant by continguous?
All the data is stored together, one element after the other
Are arrays contiguous?
yes
Are lists contiguous?
no
What are the features of an array? (5)
- static
- mutable
- ordered collection of items
- items can be changed or replaced
- can only store one data type
What are the features of a list? (5)
- dynamic
- mutable
- ordered collection of items
- items can be changed or replaced
- can store more than one data type
What are the features of a tuple? (5)
- static
- immutable
- ordered collection of items
- items cannot be changed or replaced
- can store more than one data type
What is a stack?
- A data structure that is essential for the operation of a computer
- Items can be pushed onto the top of the stack when added to it and popped off the top when they are deleted from it
- Known as a LIFO structure
What is meant by a LIFO structure?
- Last-in-first-out
- The last item to be pushed onto the stack must also be the first item to be popped off
What is the purpose of a stack pointer?
Always point to the node at the top
What is a stack overflow?
Any attempt to push an item onto a full stack
What is a stack underflow?
Any attempt to pop an item off an empty stack