LFZ data structure Flashcards

1
Q

(stacks_intro_1)

How would you examine items below the top of a stack?

A

First, pop() the top element and peek() the next one.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

(stacks_intro_1)

How would you find out how many items are in a stack?

A

pop() all element of input array and increase count by one for all pop()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

(stacks_intro_2)

What happens to the order of values that are moved from one stack to another?

A

the order is flipped

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

(stacks_intro_2)

How can a stack be returned to it’s original state after examining its internal values?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

(queues_intro_1)

How would you examine items after the front of a queue?

A

peek() method

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

(queues_intro_1)

How would you cycle through items in a queue without permanently removing them?

A

dequeue -> enqueue

How well did you know this?
1
Not at all
2
3
4
5
Perfectly