Queue Flashcards
1
Q
Which implementation of queue as array is faster?
- enqueue (beginning) and dequeue (end)
- enqueue (end) and dequeue (beginning)
A
enqueue (end) and dequeue (beginning)
Enquire at the place where is the fastest. For example:
- in array we have amortisation in putting elements at the end of fixed size memory
- in linked list we have constant time O(1) in adding elements at the beginning of the structure
2
Q
Which implementation of queue is faster?
- array
- linked list
A
Array