0

I was asked to make an algorithm to do the best fit for some music in the minimum number of folders .

The folders has a fixed size ( like the folders can only hold 100 minutes of music ).

for example : i have music with these lengths ( 50 - 30 -20 - 20 -80 - 70 -15 - 15) and the folder size is 100 mins .

The result should be 3 folders .

I don't even know how the algorithm works . any ideas ?!

  • Please **research** and come back with a **specific question**. – Zabuzard Nov 26 '17 at 14:52
  • 1
    Try to find number of possible combination of `unique` elements whose sum is 100 or any required value.Remember one thing, the elements should not be repeated in next choose. – krpra Nov 26 '17 at 15:09

1 Answers1

2

It looks like bin packing problem which is NP-hard Problem.So you have to try every possible combination until the sum of a certain combination exceeds the target number, you can stop calculating that branch and move on to the next branch.

Now you can optimize your result and count the minimum number of combinations whose sum is 100 or any target number and that minimum will give you the Number of folders needed for storing the data.I hope it helps.

krpra
  • 466
  • 1
  • 4
  • 19