perlquestion
amaguk
Hi,
<p>
I've some questions about a practical problem. I've a directory with a lot of files. I want to burn some CD with these files, but how can I maximise the content of each CD, and minimize the total number of CD ?
</p>
<p>
Is there an existing script (nothing found during my search, but...).
</p>
<p>
Is there a good algorithm ?
</p>
My first thinking are : <br>
- number of CD = round up (total size in Mo / 700Mo)<br>
- in CD1, I put the largest file if total size of CD1 is < 700Mo or on the following CD;<br>
- in CD2, I put the second largest file if total size of CD2 is < 700Mo or on the following CD;<br>
- in CD3, I put the third largest file if total size of CD3 is < 700Mo or on the following CD;<br>
- in CDn, I put the nth largest file if total size of CDn is < 700Mo or on the following CD;<br>
- and I loop on the first CD ! <br>
- If there is always files and all my n CD are full, I create a new CD where I put these files. <br>
</p>
<p>
Is there a better algoritm (I guess yes ;)) ?
</p>
<p>
Thanks in advance
</p>