File Backup

How does one go about calculating the minimum number of floppy disks required to backup a given list of files? I believe this is called the 'KnapSack' problem, but I've never managed to find someone who's solved it.

Hmmm... I've solved it. And so has others i know... However, a few assumptations must ofcourse be made.

Okie. Assumptations are as follows:
You have a list of files, and ofcourse the sizes in bytes of each file.
You know what kind of floppies will be used, and all floppies are equal.
AND, the floppies ain't formatted in some weird format.
Standard floppy format uses a block size of 512 bytes.

I'll just pretend all files are smaller than the available space on one floppy. If you need to split files, filling up the floppies ain't a problem.

Calculate number of blocks on floppy, by taking size of an empty floppy and divide by 512

Take all the file sizes. If they are not dividable by 512, increase their sizes until they are.

Divide all sizes by 512 and store these values as the file sizes. Sort the filelist based on size, largest files first

Featured Post

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

The uses clause is one of those things that just tends to grow and grow.
Most of the time this is in the main form, as it's from this form that all others are called.
If you have a big application (including many forms),
the uses clause in the in…

In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work. Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…