Please answer the following question and explain your answer
Please answer the following question, and explain your answer
In order to reach O(1) for both enqueue and dequeue on array-based queues, we will need to use: an array by shifting the elements to the right for enqueue and shifting to the left for dequeue a logical circular array both A and B none of the aboveSolution
The answer is B. We need to use a circular araray and use two points for front and rear. For enqueue we add a element at the rear and move the rear one position, for dequeue we remove the element at front and we move the front one position.
