Hi,

Im new to algorithms, so this might be a simple question for most of you


Lets say there are 5 trucks, each of which can take 100kg load. And they
are filled to some extent randomly.
Let the free quantity be 40kg, 30kg, 20kg, 80kg, 60kg respectively. At any
given time only single load comes.
Lets say a load of 25kg comes, we have to select the truck where it fits
leaving less free space, here 30kg
Now the free quantities are 40, 5, 20, 80 and 60. Next if a load of 10kg
comes, we have to select the truck with 20kg free space.
and go on...

Write a java code for selecting a truck for the above situation when the
number of trucks is very large.
It should be with least time and space complexity with minimum number of
iterations in the loop
(interviewer said its part of a very large application which takes huge
system resources, so this part of the code should be very efficient)

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to