Array features
Ordered, mutable, static, one data type
Tuple features
Preferred, immutable, static, different data types
Record features
Fixed number of fields of different data types, implemented with each row as a tuple
Static vs dynamic
Dynamic data structures can change static data structures cannot change size
Examples of abstract data types
List, stack, queue, graph, tree, hash table, linked list
Examples of compound data types
Strings, arrays
Examples of primitive data types
Integer, boolean, real
Four operations in queues
Add item to rear of queue
Remove item from front of queue
Check if queue is empty
Check if queue is full
Adding to circular queue
next index = (current +1) MOD len
Implementation of a dynamic list
New location taken from the heap of memory locations for dynamic allocation
When item is deleted, memory location is returned to heap, pointers keep list in user-specified order
List operations
isEmpty()
append(item)
remove(item)
count(item)
len(list)
index(item)
insert(pos,item)
pop(pos) - default -1
Linked list features
Composed of nodes with two parts: the data and the pointer
Start pointer identifies first node
Nextfree pointer shows index of next free space in array
(ALPHABETICAL/ASCENDING ORDER)
Linked list operations
.data()
.pointer()
Stack operations
push(item)
pop()
isFull()
isEmpty()
peek()
size()
Stack overflow error
Attempting to push onto a full stack
Stack underflow error
Trying to pop from a stack that is empty
Call stack
System level data structure that provides mechanism for passing parameters and return addressees to subroutines
Stack function in subroutine calls
The parameters are saved onto the stack
The address where execution will return to is saved
Execution is transferred to the subroutine code
Stack function in subroutine execution
Stack space is allocated for local variables (recursive routines use much more space and more often cause overflow errors)
Subroutine code executes
Return address received
Parameters popped
Execution transferred back to return address
Stack uses
Undo/redo in word processors
Holding website addresses just visited
Interrupts
Hashing definition
Address of data to be stored is calculated from the data itself using a hashing algorithm (often involves MOD)
Collision
When the hashing algorithm generated the same address for different primary keys (IMPOSSIBLE TO AVOID)
Dealing with collisions
Put in next free spot, or next third free spot (must ensure every cell in table is covered)
Searching for items in a hash table
Perform hashing algorithm on item
If not in that cell check next
Keep checking until item or empty cell is found
Empty cell means item is not in table