Assume that a queue is implemented by using an array: then
When ever an element is deleted from the queue, then all the other elements have to be moved down one place in the array.
What is the time complexity of moving all the elements by down one index?
Since we cant remove elements from middle, so assuming that array has full elements, then moving all the elements by down one index it takes O(n).
Back To Top