push / enqueue
- arguments: new value
- push: adds a new node with the given value at the top of the stack
- enqueue: adds a new node with the given value at the end of the queue
pop / dequeue
- arguments: none
- pop: removes the node at the top of the stack and returns its value
- dequeue: removes the node at the front of the queue and returns its value
peek
- arguments: none
- returns either the top of the stack's value or the front of the queue's value
is_empty
- arguments: none
- checks to see if a stack or queue is empty, returns a boolean
Link to Figma Board of image above for queues
Link to Figma board of image above for stacks
Stacks: Time: O(1) - because only deals with one node at a time for all of these method, since the node’s being accessed are only on the top Space: O(n) - because it will be the amount of space for each of the nodes in the stack
Queues: Time: O(1) - because only deals with one node at a time for all of these method, since it knows the head and tail of the queue Space: O(n) - because it will be the amount of space for each of the nodes in the queue
Terminal command: python3 -m pytest



