Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Approach: Assume you are at the airport, waiting for the security check. There i

ID: 638457 • Letter: A

Question

Approach: Assume you are at the airport, waiting for the security check. There is one line (which is a FIFO queue), and 5 security check gates. Each person reaching in front of the queue is checked by the first available security gate. Each security check gate has its pace of handling passengers, as follows: gate #1, 1 person/minute, gates #2 and #3, 2 persons/minute, and gates #4 and #5, 3 persons/minute. Assume that initially there are 20 people in the line and each minute other 10 people are coming to the line. Show the evolution of the line in the first 10 minutes. For this, use a queue to model the line, add the initial passengers (give them names Passenger1, Passenger2,

Explanation / Answer

there is a mistake in your approch

from queue they will send one person at a time hence you can't pop two people and send themm to 2&3 checkout and 3 each to 4 & 5

first all are empty

time=0

p1->c1

p2->c2

p3->c3

p4->c4

p5->c5

t=20sec

p6->c4

p7->c5

t=30sec

p8->c2

p9->c3

t=40sec

p10->c4

p11->c5

again at t = 1min all checkouts are empty you can repeat the same

since we have to output the status only begin of minute

before 10 minutes queue will not become empty

int i,t=0;

while(t<10)

{

for(i=1;i<6;i++)

{

printf("P%d->%d",t*11+i,i);

}

}

code has to be changed if t is in middle of minutes

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote