Liquidated Data Structures Flashcards
Describe arrays.
A data structure for storing an ordered, finite set of elements of a single data type within a single identifier.
Always zero-indexed unless stated otherwise.
What are 1D arrays considered to be?
Linear arrays
2D ARRAYS
How can they be visualized?
As a table or spreadsheet.
2D ARRAYS
How do you search across them?
When searching through them, go down the rows then across the columns to find a given position.
3D ARRAYS
How can they be visualized?
3D arrays can be visualized as a multi-page spreadsheet, or as multiple 2D arrays
3D ARRAYS
How do you search across them?
The three dimensions are used [z,y,x].
Z is the array number, y is the row number, x is the column number
Describe records.
A data structure that stores data in a row of elements called fields, organised based on attributes.
Describe lists.
A data structure that stores a sequence of data values, each with a unique index.
How are lists different from arrays?
They can contain elements of more than one data type.
Describe static and dynamic data structures
Static
• Structure size cannot change at runtime
Dynamic
• Structure size can change at runtime
Describe mutable and immutable
Immutable
• Structure/data cannot be changed at runtime (overall cannot be modified)
Mutable
• Structure/data can be changed at runtime
Describe stacks.
A Last in First out (LIFO) data structure.
Items can only be pushed (added) or popped (removed) from the top.
The top is identified with a top pointer.
It is preferably static. (easier to implement, more efficient memory use)
Describe linear queues.
First in First out (FIFO) data structure
Items are added to the end (enqueue) and removed at the front (dequeue).
Has a front pointer and a rear pointer.
Describe circular queues
First in First out (FIFO) data structure
Once the queue’s rear pointer is equal to the max size of the queue, it can loop back to the front of the array and store values here, provided it is empty.
Harder to implement, but uses space in an array more effectively.
Define tuple
A data structure for storing an immutable, ordered set of data, which can be of different data types within a single identifier.