Answered You can hire a professional tutor to get the answer.
The Queue Phrase Rearrange Problem For this problem, you are given a queue filled with a garble of words.
The Queue Phrase Rearrange Problem
For this problem, you are given a queue filled with a garble of words. Your job is to reorder this queue so that instead of saying gibberish, it quotes the iconic 1999 hit song "All Star" :
("Somebody once told me the world was gonna roll me")
You cannot just demolish the whole queue and start from scratch however - that'd be silly and kind of useless as an exercise. You're given a placeholder to hold onto the value of one queue element at a time, and you must use queue functions to move through the queue and add the element to its proper position. You can only use your existing queue and the placeholder element to move stuff!
Given queue elements have to be re-added after they've been removed or they'll be lost, you're also given a placeholder for the element you just saw, in case you are moving through elements and need a place to keep one that isn't the one you're currently trying to reorder.
HINT: You'll probably be modifying the element you just saw fairly often, and only modifying the moving element once you've made a positioning decision about something or seen something you know you want to seek a position for next!
Then, because we're already in too deep with the meme here and it's easy finish that exemplifies all you've accomplished here, add the iconic chorus bit one word at a time to the queue.
Here is what I have:
public static void queuePhraseRearrangeProblem() {