Question: Queue Lab The store manager decided to giveaway Giants and Jets t - shirts to their customers since they were shutting down the business. People

Queue Lab
The store manager decided to giveaway "Giants" and "Jets" t-shirts to their customers since they were shutting down the business. People supporting their team had to carry a sign that says whether they are "Giants" fan of "Jets". Store manager has no other employee to help him out and had all the t-shirts piled up in one single pile. So he came up with his own rule. The rule is simple: If customer in a queue is carrying sign that says "Giant" AND t-shirt on the pile is "Giants" t-shirt (or if customer in a queue is carrying sign that says "Jets" AND t-shirt on the pile is "Jets" t-shirt) then customer takes the t-shirt and leave the queue otherwise customer joins back queue at the end of the line. This continues until none of the queue customer want to take the top t-shirt or there are no more t-shirts left. You need to design you program to find out how many customer will end up getting no t-shirts.
Example Input and output:
Input(two arrays of String): , customers =[G,G,J,J],t-shirts =[J,G,J,G]
Output(integer) :0
Step by step process for sample input/output:
\table[[Operation,\table[[t-shirt],[(front,....,end)]],\table[[Customer],[(front,.....,end)]],Explanation],[\table[[compare],[new state]],\table[[J,G,J,G
 Queue Lab The store manager decided to giveaway "Giants" and "Jets"

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!