Chapter 4: Stacks and Queues Flashcards
1
Q
Why use stacks and queues?
A
They are programmer tools for in-memory storing of data that needs to be referenced sequentially, as it is encountered
2
Q
How are stacks and queues more abstract than arrays?
A
They are arrays but through an interface of restricted access
3
Q
What is the Big O complexity of pushing and popping an item onto a stack or queue?
A
O(1)
4
Q
Priority queues are used for?
A
Finding the cheapest or shortest way to do something
5
Q
Insertion for a priority queue implemented as an array
A
O(n) - insert item at top and sift to position