Hi This is what i have to do, suppose have 3 points A-B-C then i have to find the shortest distance to travel, but this is not as simple as travel sales man problem because A-B is not as same as B-C So suppose i have A-B is 2 A-C is 1 B-A is 3 B-C is 2 C-A is 4 C-B is 3 then i have find what is the best of A-B-C or A-C-B or some thing else, any ideas?
On 8/10/07, Antonio Petrelli <[EMAIL PROTECTED]> wrote: > > 2007/8/10, Ashish Kulkarni <[EMAIL PROTECTED]>: > > Hi > > I have a program which creates permutations for 10 letters, so the > values i > > get is 10 ^10 which is more then 3 million > > Do you mean permutations (the same letters ordered in different ways) > or dispositions with repetition (the 10-letter group can be taken from > the 26 letters of the alphabet, can be repeated and can stay in any > order)? > Permutations: 10! possibilities > Dispositions with repetition: 26^10 > > > Now i have to go through all 3 million records and do some calculations > to > > determine the best possible combination . > > > > Any ideas what i should use, LinkedList, ArrayList, HashMap, > > what would be the best way performance wise > > > > should i use primitive or objects for calculations. > > Any suggestions on approaching this problem. > > IMHO it's better not to do it! :-) AFAICT, either way you are using > permutations or dispositions with repetition, it is a O(e^n) problem, > i.e. exponential complexity. > I think that you need to change the problem, or solve it in another > way, to go down to polynomial complexity. > The answer, then, is that the complexity does not depend on the > array-like structure you are using. > > Just my 0.02 euros. > Antonio > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >