1.4.2 Data Structures Flashcards
(11 cards)
Types
Array: Fixed size, static, holds a single data type
List: No fixed size, dynamic, hold multiple data types
Tuple: Is immutable. Round brackets not square brackets
Record: Made up of fields
Linked list
Each item is called a node
Datafield: The actual data
Start Pointer
NextFree Pointer
For each record: Index, Data, Pointer
Graphs
Implemented using an adjency matrix or adjacency list
Directed Graph: Only traversed on direction
Undirect Graph: Edges traversed both directions
Weighted graph: Each arc has a cost
Stacks
Stack underflow: When item called but is empty
peek() – returns top value
Used to reverse actions
Queues
Queue overflow
Head and tail pointer
Circular queues:
Rear point that can loop back to the front
Trees
Node
Edge
Root
Child
Parent
Subtree (Section)
Leaf (No children)
Binary tree
Each node stored with left and right pointer
Hash tables
Array coupled with hash function
Colision: Next available location
Pre-order
Root node, left subtree, right subtree
(Pass)
In-order
Left, root, right
(Pass under)
Post-order
Left, right, root
(pass on right)