SLR14 -Data structures Flashcards
What does contiguous mean in regards to arrays
All data is stored in the same place
Describe the features of arrays
Static
Contiguous
Homogenous - only support a single data type
Describe a record data structure
A collection of connected fields similar to a database or dictionary
What are the 3 steps of using a record structure
Define the fields in the record
Declare a variable or array to use with it
Assign and retrieve data from the record
Describe a tuple
A immutable list that can store multiple data types and cannot change after runtime
What is the difference between lists and arrays
Lists can store multiple data types whereas arrays can only store 1
What does static mean
Size cannot change after runtime
What does immutable mean
Structure/data cannot be changed after runtime
What is a stack
A data structure where items are both added and removed from the top of the list
What does LIFO mean
Last in first out
What does FIFO mean
Fist in first out
What are the 3 operations that can be performed on a stack
Push
Pop
Peak
What is a queue
A data structure where items are added to the back of the list and removed from the front
Which position can you “peek” to when using a queue data structure
The front
Describe the stages of adding data to a stack
Check if there is room
Increment the stack pointer
Insert the new item at the position of the stack pointer