letting [ be the front of the queue and then letting the queue grow from there this is not an efficient solutionhoweverfor it requires that we move all the elements forward one array cell each time we perform dequeue operation such an implementation would therefore take (ntime to perform the dequeue methodwhere is the current number of objects in the queue if we want to achieve constant time for each queue methodwe need different approach using an array in circular way to avoid moving objects once they are placed in qwe define two variables and rwhich have the following meaningsf is an index to the cell of storing the first element of the queue (which is the next candidate to be removed by dequeue operation)unless the queue is empty (in which case rr is an index to the next available array cell in initiallywe assign which indicates that the queue is empty nowwhen we remove an element from the front of the queuewe increment to index the next cell likewisewhen we add an elementwe store it in cell [rand increment to index the next available cell in this scheme allows us to implement methods frontenqueueand dequeue in constant timethat iso( time howeverthere is still problem with this approach considerfor examplewhat happens if we repeatedly enqueue and dequeue single element different times we would have if we were then to try to insert the element just one more timewe would get an array-out-of-bounds error (since the valid locations in are from [ to [ ])even though there is plenty of room in the queue in this case to avoid this problem and be able to utilize all of the array qwe let the and indices "wrap aroundthe end of that iswe now view as "circular arraythat goes from [ to [ and then immediately back to [ again (see figure figure using array in circular fashion(athe "normalconfiguration with < (bthe "wrapped aroundconfiguration with the cells storing queue elements are highlighted