Data structures Flashcards
abstract data type
Logical description of how we view the data and possible operations
4 operations of a queue
Add item to the rear of the queue
Remove item from the front of the queue
Check if the queue is empty
Check if the queue is full
Dynamic data structure
Allocates and deallocates memory from the heap
Excessive allocation of memory with our deal location may cause overflow
Python- list
Static data structure
Cannot grow shrink or be freed during execution
An array is a static data structure
4 operations of stack
Add an item to the top
Remove an item from the top
Check if the stack is full
Check if the stack is empty
Pseudo code for stack
Push - adds item to the top of the stack
Pop - removes and returns the item on the top of the stack
Is full - checks if the stack is full
Is empty - checks if the stack is empty
Underflow
Attempting to pop from a stack that is empty
What is the call stack
System level data structure
Provides mechanism for passing parameters and return addresses to subroutines
Call stack is hidden in high level languages
Subroutine calls in the call stack
The parameters are saved unto the stack
Local variables are saved onto the stack
Address to which execution returns after the end of the subroiutine is saved onto the stack
Execution is transferred to subroutine code
Subroutine execution in the call stack
Stack space is allocated for local variables
Subroutine code executes
Return address is retrieved
Parameters are popped
Execution is transferred back to the return address
What is a collision
When an algorithm generates the same address for different primary keys
What is the midsquare method
- first square the item
- extract some portion of the resulting digits
- perform the mod step to get an address
the folding method
- divide the item into equal size pieces
- add the pieces together
- perform the mod step to get an address
what is an undirected graph
it is undirected because there are no arrows on the edges indicating direction
definition of a tree
tree is connected undirected graph with no cycles