Lunatic Server Solutions Interview Question for Developer Program Engineers
- 0of 0 votes
Consider a service counter. People waiting for service form a queue. At the start, the queue is empty and- PriyaDarad May 22, 2012 in United States
time is 0. The service time per person is 3 minutes.
The input to the program consists of an integer N followed by a sequence of integers indicating the arrival
time (in minutes) of the customers. These times are given as offset from the start of the simulation, so that an
input of 44 means 44 minutes from the start of simulation. The sequence of input numbers is terminated by
the number -1.
Your program must simulate the queue and print out the following:
1. The number of customers waiting in the queue at time = N minutes from the start of simulation.
2. The arrival times of the customers in the queue at that time, in increasing order.
Each integer must be separated by a space. Terminate your output with a newline character.
For doing the computation, you can assume that if the counter is expected to be vacant at time t, the first
person in the queue will be scheduled for service, before the counting is done for time t.
You must use the queue data structure to solve this problem.
9 0 2 5 6 6 8 10 -1
2 6 8
| Report Duplicate | Flag | PURGE
Lunatic Server Solutions Developer Program Engineer Data Structures
Interview Type: Written Test
Open Chat in New Window