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

Algorithms There is a jail in the desert. A rebellion broke out and a single gua

ID: 3783934 • Letter: A

Question

Algorithms

There is a jail in the desert. A rebellion broke out and a single guard is immobilized. He helplessly watched the prisoners left one by one with different speed in different directions. Later, he freed himself and took a motorbike with an extra seat. Now, he can follow the footprints and pick up one prisoner at a time and bring them back to jail. Each prisoner moves with constant individual speed v_i and left the jail at time t_i. In which order does the guard bring prisoners back in order to minimize the time?

Explanation / Answer

The guard must bring the prisoners in reverse order like if there is n number of prisoners left the jail gaurd should bring n prisoner first and n-1 second and n-3 third

So the algorithm for the total time to bring back the prisoners to jail is

Total Distance = vntn+vn-1tn-1.........+v0t0

Total ttime=tn+tn-1+tn-2........+t0

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