Question: Below is the prompt to be implemented in JAVA with 2 sample input/outputs to test with In this friends-queue each person belongs to exactly one
Below is the prompt to be implemented in JAVA with 2 sample input/outputs to test with



In this friends-queue each person belongs to exactly one fried-group. If a person arrives to be added to the queue and none of their friends are already in the queue, then they join the queue at the very end. Otherwise, if some of their friends are already in the queue, they join that friend-group (within the friend-group, they queue up after the last of their friends). Dequeuing works the same as in the standard queue. The other change from the standard queue is the naming convention. For some unknown reason, Michelle is supposed to call it push when the new element/friend is added to the queue (rather than the typical enqueue), an to use pop as the name of the operation that dequeues an element/friend. Help Michelle by implementing the friend-queue. Input The 1st line contains an integer 1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
