LFZ data structure Flashcards
(stacks_intro_1)
How would you examine items below the top of a stack?
First, pop() the top element and peek() the next one.
(stacks_intro_1)
How would you find out how many items are in a stack?
pop() all element of input array and increase count by one for all pop()
(stacks_intro_2)
What happens to the order of values that are moved from one stack to another?
the order is flipped
(stacks_intro_2)
How can a stack be returned to it’s original state after examining its internal values?
We need another stack to hold all the other’s stack.
After popping up all values from the origin and store them to another stack, it need to revert all values again.
(queues_intro_1)
How would you examine items after the front of a queue?
peek() method
(queues_intro_1)
How would you cycle through items in a queue without permanently removing them?
dequeue -> enqueue