You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Peek O(1) Traditionally, you always want to Peek before conducting a Pop. This will ensure that you do not receive a NullExceptionError on your Pop action.
ALGORITHM Peek()// INPUT <-- none// OUTPUT <-- Node of top of stack
`return Top`
Queue
Queues follow these concepts:
FIFO - First In First Out - This means that the first item in the queue will be the first item out of the queue.
LILO - Last In Last Out - This means that the last item in the queue will be the last item out of the queue.