in reply to Re^2: Help with Space Efficency algorithim
in thread Help with Space Efficency algorithim
I would agree with your assessment. If the data is known ahead of time, then you can use the standard bin packing solutions.
If you are getting the new data over time, perhaps adding the new data to the directory with the smallest amount of space free larger than the size of the new data may be appropriate. I think that this would give the best packing over time.
@spaces = map {{dir => $_, size => dir_size($_)}} foreach (@dirs); $small_space = (sort by_dir_size grep larger_than_needed @spaces)[0]; store_in_space($newdata, $small_space);
code is pseudo code, but almost perl
--MidLifeXis
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Help with Space Efficency algorithim
by dragonchild (Archbishop) on Dec 27, 2007 at 21:06 UTC | |
by MidLifeXis (Monsignor) on Dec 27, 2007 at 23:17 UTC | |
by dragonchild (Archbishop) on Dec 28, 2007 at 04:32 UTC |