Vegeta Posted October 23, 2005 Share Posted October 23, 2005 Hi, I'm planning to write a small application like "Burn for the Brim" for my own with AutoIt without all the features I don't need. For all who don't know the program it's filling a medium (CD/DVD) optimally with your files. It circles thru all possibilities and gives the best (or one of them) solution to you. To work with this problem two arrays are made. Array 1 with the filename and array two with the filesize. Array 1, Array 2 File1, 200 MB File2, 300 MB File3, 500 MB There are 6 different combinations possible: 1 2 3 1 3 2 2 1 3 2 3 1 3 2 1 3 1 2 For a medium with 700 MB the solution 1 3 is the best, it fills the CD optimally. My problem is now that I don't have a good idea how to program an algorithm that loops all possible solutions with x files. Can anybody give me a hint how I can solve this problem? Thanks, Vegeta Link to comment Share on other sites More sharing options...
Skruge Posted October 24, 2005 Share Posted October 24, 2005 Sounds like a job for a nested For loop. Also, it would help if you sort your arrays by filesize. [font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font] Link to comment Share on other sites More sharing options...
jdickens Posted October 25, 2005 Share Posted October 25, 2005 Hi Vegeta: There is also the other poss.: 1 2 3 1 + 2 1 + 3 2 + 3 I think this is a non-trivial algorithm to do elegantly. J If I am too verbose, just say so. You don't need to run on and on. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now