1.4.2 Data Structures Flashcards
what does dynamic and static mean
Dynamic - size can change
Static - Size cannot change
how does a stack work
First in last out
adds data to the top of the stakc
What are the operations for a stack
push -add item to the top
Pop - remove item from the top
isfull - check if stack is full
isEmpty - check stack is empty
define array
A data structure where a contiguous section of data is allocated to RAM
Single data type
define record
Multiple values under one identifier can be different data types
row in a table
what are the features of a list
Mutable (items can change)
can store multiple data types
What are the features of an Array
Mutable (items can change)
only one datatype
What are the features of a Tuple
Immutble (items cant change)
can store multiple data types
define graph
an abstract data structure representing complex relationships
what are the features of a graph
not heirarchial
can be directed
can be weighted
can have cycles or loops
what are the characteristics of a tree
Heircahial data structure
Data stored in nodes
Has leaf nodes
no cycles or loops
why use a hash table
when searching through a large data set binary search becomes exponentially quicker
but may take a long time to sort data
however a hash table can find an address almost instantly
what are the four key operations on a Queue
Append - enqueue
dequeue
isEmpty
isFull
describe how an array can be used ot store and access data in a stack [4]
Pointer to the next free space (top of the stack)
when data added
added to pointer position/pointer+1
check if stack is full
pointer incremented
when removing data
check empty
pointer = pointer -1
pop and push