Data Structures Flashcards
Array
Store multiple items of same data type, homogenous
Static
Record
Collection of related fields (variable, each diff data types)
Define, declare and assign
Array of records to store multiple records
Tuple
Immutable
Static
Better for memory than lists
Stack
LIFO
Pop, push
Functions:
call stack (keep track of addresses control must return to when subroutine ends)
Queues
FIFO
enQueue(), deQueue()
Functions:
Output waiting to be printed
Linear queue (items move up when removed or pointers)
Circular queue
Priority Queue
List
Dynamic tuple
Linked list
Versatile data structure
Items not in contiguous data locations
Graphs
Dynamic data structures
Undirected/directed
Weighted/unweighted
Adjacency matrix vs list
Graph storing
Poor for memory
Vs
Better for memory
Depth first
Use stack
Start at root down 1 branch as far as possible
Backtrack
Breadth first
Use queue
Root, scan left to right
Binary Search Tree
Max 2 children
Data placed left if smaller and right if smaller
Hierarchy
Hash table
Combine arrays and linked list Fast search Index physical address on file where data is held used Hash junction is used Collision can occur
Variable vs Constant
Identifier that refers to memory location, value of which changes during run time
Vs
“” - does not change