unit 3 aos 1 Flashcards
signature specifications
Array
Create: int > array
Set: array x int x element -> array
Get: Array x int -> element
List
Create: -> List
IsEmpty: List -> Boolean
Get: List ×Integer -> Element
Set: List ×Integer ×Element -> List
Insert: List ×Integer ×Element -> list
Delete: List ×Integer -> List
Stack
Create: -> Stack
IsEmpty: Stack -> Boolean
Push: Stack ×Element -> Stack (put an element in a stack)
Peek: Stack -> Element (see what value is on top of a stack)
Pop: Stack -> Stack (remove the top value from a stack)
Queue
Create: -> Queue
IsEmpty: Queue -> Boolean
Enqueue: Queue ×Element -> Queue (add element to queue)
Peek: Queue -> Element (returning element on top of a queue)
Dequeue: Queue -> Queue (removes last element in a queue)
Priority Queue
Create: -> Priority Queue
IsEmpty: Priority Queue -> Boolean
InsertWithPriority (enqueue): Priority Queue ×Element ×Integer -> Priority Queue
GetMin: Priority Queue -> Element
RemoveMin (dequeue_min): Priority Queue -> Priority Queue
Dictionary
Create: -> Dictionary
HasKey: Dictionary ×Element -> Boolean (if element has key)
Add: Dictionary ×Element ×Element -> Dictionary
Update: Dictionary ×Element ×Element -> Dictionary
Remove: Dictionary ×Element -> Dictionary (the whole set of the key)
Get (key): Dictionary ×Element -> Element
Graph
Create: -> Graph
AddNode: Graph ×Element -> Graph
AddEdge: Graph ×Element ×Element -> Graph
Adjacent: Graph ×Element ×Element -> Boolean (2 edges see if its next to each other?)
Neighbours: Graph ×Element -> List