Stacks And Queues Flashcards
Are stacks FIFO or FILO?
FILO
Which function adds an item to a stack?
Push
Which function removes an element from a stack?
Pop
What is the significance of the back pointer in the array representation of a queue?
Holds the location of the next available space in the queue
Which function returns the item at the front of a queue without removing it?
Peek
What is the purpose of the front pointer in the array representation of a queue?
Points to the space containing the first item in the queue
What value is the top pointer initialised to in the array representation of a stack?
-1
Give pseudocode for the function which adds new elements to stacks.
Stacks: pushelement; top = top + 1
Give pseudocode for the function which adds new elements to queues.
Queues: enqueueelement; back = back + 1
Which function returns the item at the top of a stack without removing it?
Peek