Hi, Nice problem :)
Would you mind giving a little more info to help determine which might be a useful approach? I'm having a little trouble understanding the nature of your array. You say it is two dimensional with 24 rows (2 x 24 = 48?) but I'm missing what this looks like if each element holds 20 floating point values. Is this 2 x 24 x 20 elements? Could you provide a dummy example of the input data and required result? Also, could you give some idea about when the array is loaded - as you go, changes etc? Off the top of my head a lot of work can be avoided by using something like a sorted binary tree data abstraction (higher values to the right and top most). I'll have a look to see if I can find a reasonable data abstraction with appropriate methods etc. The abstraction has strengths and weaknesses. Given the CPU load of the sort, the weaknesses (relatively minor anyway) might be irrelevant. The upshot is that each time data is entered into the binary tree it is automatically sorted (stumps, branches and leaves). Finding the top n permutations should then be relatively easy because the hard work is done already - plus it's reasonably flexible. It dramatically reduces the number of iterations required to identify top (or low) values or sequences. I recall coming across a very efficient iterative process used to calculate fibonacci values. I know this is not the required process but the algorithm is powerful and transferable to other settings. Kindest regards, Mike Culleton -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Cosmin Prund Sent: Friday, 28 September 2007 11:28 PM To: Borland's Delphi Discussion List Subject: RE: Sorting 24 floats billions of times - or not > On 28 septembrie 2007 07:07 Behalf Of Chris Stebbing wrote: > Subject: Sorting 24 floats billions of times - or not > > Hi All, > > I have an application which has a two dimensional array of 24 rows > each containing 20 floating point values. I need to analyse every > single combination of every single set of 24 values. Essentially I > only need to obtain the top 5 values for each permutation, many of > which are going to be the same of course. The answers lays in the nature of the "top values" function. If that function has no special properties one might use to shortcut the huge loop, then I doubt there's any computer out there that can do it within our collective life span, because you basically need to test all possible combinations. How do you define "top values"? -- Cosmin Prund _______________________________________________ Delphi mailing list -> [email protected] http://www.elists.org/mailman/listinfo/delphi ---------------------------------------------------- This message has been processed by Firetrust Benign. _______________________________________________ Delphi mailing list -> [email protected] http://www.elists.org/mailman/listinfo/delphi

