Queue question is wrong?


Can someone offer a second opinion? I am confident this is not supposed to be the correct answer, yet it is seen as the correct answer. I think the correct answer is the last answer i.e. Adam > Charlie >Bob > Ann.
This stuff is messing with my head and making me uncertain whether I understood the theory or not.
If I am wrong if someone would be so kind as to explain why, please do so!


Imagine a line (“queue”) If you are the first one enqueued"(to get in line") you will be the first to be seen (“dequeued”)
In a linked list the head ptr directs you to the first node. The head ptr in this case points at ann. Everyone else is behind her. She points at the customer behind her and so forth. For Adam to get in line, he must go to the back. He will be the last one seen.


Obviously, but why is that seen as a wrong answer?
As you can see on the screenshot, Adam does not get in the back but at the frond, and that is accounted as correct.


I always join a queue at the end/back, and hopefully so does everyone else

if i go to theme park, and there queue for the rollercoaster, i stand behind the people already in the queue, you can’t skip pass all the people already in the queue.

ann was the first to arrive at the rollercoaster, so she at the front of the queue, so ann will also be the first person to be dequeued when there is a free spot on the rollercoaster. Then Bob arrived, join the queue behind Ann, then Charlie joined the queue behind Ann and Bob and finally Adam arrives. Adam takes his spot (at the end of queue, behind Charlie)

don’t be fooled by the Queue: [Charlie, Bob, Ann] at the left side of the screen, this queue is resolved (dequeued) from right to left, the right most person (Ann) was first in queue. For some reason new people are inserted at the left side.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.