Data Structures/Algorithms Flashcards Preview

Web Dev > Data Structures/Algorithms > Flashcards

Flashcards in Data Structures/Algorithms Deck (5)
Loading flashcards...
1
Q

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

A

stack.pop => stack.peek

2
Q

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

A

Have a counter that increments until stack.peek() is undefined

3
Q

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

A

The order is reversed

4
Q

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

A

push all values from other stack back into original stack

5
Q

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

A

queue.dequeue then queue.peek