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

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

Which implementation of queue is faster?
- array
- linked list

A

Array

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