Consider the queues containing four elements and containing none (shown as the Initial State in the figure). The only operations allowed on these two queues are Enqueue(Q, element) and Dequeue(Q). The minimum number of Enqueue operations on required to place the elements of in in reverse order (shown as the Final State in the figure) without using any additional storage is ______.
Tap to open full sizeFigure description
Two labeled box diagrams side by side. Left diagram, titled 'Initial State': an arrow labeled 'Head' points into the front of queue Q1, which is drawn as four cells left to right containing 1, 2, 3, 4 (so 1 is at the head/front); below it, queue Q2 is drawn as four empty cells, with an arrow labeled 'Head' pointing into its front (leftmost) cell from below. Right diagram, titled 'Final State': same layout — Q1 is drawn as four empty cells with a 'Head' arrow into its front; Q2 is drawn as four cells containing 4, 3, 2, 1 left to right (so 4 is at the head/front), with a 'Head' arrow into its front cell from below.