Question: undefined Question-1: Existing Programming, Analysis and Criticize [10 Marks) Considering the Queue implementation using array, the implementation of the enQueue method has a time complexity

undefined
Question-1: Existing Programming, Analysis and Criticize [10 Marks) Considering the Queue implementation using array, the implementation of the enQueue method has a time complexity of O(1) most of the time. But in the case of inserting a new element into the queue, if the queue is not full and the rear is pointing to last index of the array (front != 0 && rear == capacity - 1). This case requires shifting the elements and adjusting the front & rear pointers. The time complexity in this case is O(n). Another way to implement this case is by implementing the shifting operation in de Queue method by shifting the elements every time an element is removed. Analyze both of the above implementations and answer the following questions: a. Write the implementation of de Queue that shifts the elements each time is it executed. b. Explain which implementation are better in-terms of performance. [04 Marks]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
