Khan.randRange(5, 10) Khan.randRange(0, maxSize-1) Khan.randRange(0, maxSize-1) Khan.randRange(0, 999) aqueueEnqueuePRO.initJSAV(maxSize, front, rear, insert_value)

Show how the enqueue operation works by selecting a position for where the new item goes, and update "rear" and "front" if appropriate.

To insert a value into the queue, first click on it and then click "Insert". To move "front" or "rear", click it, then click the desired position in the queue.

[aqueueEnqueuePRO.userInput]
if (!aqueueEnqueuePRO.checkAnswer(maxSize) && !guess[0]) { return ""; // User did not click, and correct answer is not // initial array state } else { return aqueueEnqueuePRO.checkAnswer(maxSize); }

We always insert to the rear of the queue.

But we have to update "rear" first by moving it one step clockwise.

Move "rear" one step clockwise. Then Click on the empty space that "rear" now points at to highlight it and then click "Insert".

SPECIAL CASE: We require that there always be one empty position in the queue's array. If there is only, then it is full and nothing can be inserted. So just click "check answer".