Re: [algogeeks] Re: Permutation of Array.

2010-08-22 Thread srinivas reddy
@aravind prasad cool man check this case consider the case 12 122 so if u arrange sub string(i.e; 12) as the first one so u have the best value 12 122 ok its good now suppose the case is 21 211 so according to the above way the solution is 21 211 which is not best so you have to add

Re: [algogeeks] Re: Permutation of Array.

2010-08-22 Thread Raj N
I've forgotten a case for the numbers like 632, 635. In this case while inserting, if the remainders are same 6 in this example, check the mod values for the equal length numbers. But for unequal lengths like, 12 and 126 compare the last digit of one number with the first digit of second i.e 6 1

Re: [algogeeks] Re: Permutation of Array.

2010-08-22 Thread Raj N
Take the input from the user of the min length number he would input i.e min_length. Then accept the the numbers in the form of strings and calculate the length of every number. Construct a binary search tree with fields as follows: struct node { int number;// atoi(input) int remainder;

[algogeeks] Re: Permutation of Array.

2010-08-21 Thread Aravind Prasad
for the method of comparison in insertion sort,, consider 1)compare the first digit of all nos and sort them 2)if they are same, go for next digit... correct me if am wrong... On Aug 21, 7:00 pm, Chonku cho...@gmail.com wrote: Treat each number as string and make a trie out of it. For the

Re: [algogeeks] Re: Permutation of Array.

2010-08-21 Thread aravind prasad
@srinivas reddy i suppose u took my algo wrongly.. consider ur eg: 2,242 first digits== 2,2(same) 2nd digits== 2,4(here 2 remains as it is as there is no futher digit for no 2) now arrange== 2242(output)... my algo works correctly here too.. correct me if am wrong.. On Sun, Aug 22, 2010