Stack and Queue Flashcards
1
Q
Stack can be implemented with
A
either array and linked-list
2
Q
time of stack operation
A
all o(1) (push, pop, top, isEmpty)
3
Q
If you implement stack with array
A
new item is inserted at the end of array
4
Q
If you implement stack with linked-list
A
new item is inserted at the front of linked-list
5
Q
stack is LIFO / FIFO ?
A
LIFO
6
Q
stack pop removes most recently added item or least recently added item?
A
removes the most recently added item
7
Q
queue is LIFO / FIFO?
A
FIFO
8
Q
queue dequeue removes most recently added item or least recently added item?
A
least recently added item
9
Q
queue can be implemented with
A
array or a linked list with tail
10
Q
time of queue operation
A
o(1)
enqueue, dequeue, isempty