Re: [algogeeks] an array question
we will sort the new array in desc order .. and we will carry the same order even to original array.. so after sorting the new arraay will be 90,80,23,19,10 .. so corresponding original array is 9823191 On Sat, Aug 13, 2011 at 12:50 PM, *$* wrote: > 1.scan the array and find the maximum digits of integer. lets say m.. > 2.Again scan the array and pad the intergers whose digits are less that m > (< m) with zero's .. copy the new integers in a new array > 3.sort the new array in desc order and carry the same even for original > array. > 4. Now the original array contains the required output. > ex: original aarray 23,8,19,9,1 > > max digits : 2 (for 23 as well as 19) > step 2: new array 23,80,19,90,10 > step3. sort .. 90,80,23,19,10 .. and corresponding original is .. 98231910. > > original array contains the original output.. > > > > On Sat, Aug 13, 2011 at 7:15 AM, chengjie qi wrote: > >> int compare(int a, int b) { >> string s = Integer.tostring(a); >> string y = Integer.tostring(b); >> if (s +y < y+s) >>return -1; >> else >>return 1; >> } >> >> >> use this to write quick sort , you can get the answer. >> >> On Fri, Aug 12, 2011 at 8:34 PM, Yasir Imteyaz wrote: >> >>> An array of integers is given and you have to find the largest possible >>> integer by concatenating all elements: >>> >>> example: >>> array: 87 36 52 >>> answer: 875236 >>> >>> array: 87 9 52 >>> answer: 98752 >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "Algorithm Geeks" group. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msg/algogeeks/-/_lJJOlRG_ukJ. >>> To post to this group, send email to algogeeks@googlegroups.com. >>> To unsubscribe from this group, send email to >>> algogeeks+unsubscr...@googlegroups.com. >>> For more options, visit this group at >>> http://groups.google.com/group/algogeeks?hl=en. >>> >> >> >> >> -- >> stay hungry stay foolish >> Chengjie Qi >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To post to this group, send email to algogeeks@googlegroups.com. >> To unsubscribe from this group, send email to >> algogeeks+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. >> > > > > -- > Thx, > --Gopi > > -- Thx, --Gopi -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] an array question
import java.util.Arrays; import java.util.Comparator; public class NewSort implements Comparator { @Override public int compare(Integer o1, Integer o2) { String s1 = o1.toString(); String s2 = o2.toString(); String com1 = s1 + s2; String com2 = s2 + s1; if (com1.compareTo(com2) < 0 ) { return 1; } else if (com1.compareTo(com2) == 0) { return 0; } else { return -1; } } public static void main(String[] args) { Integer[] a = new Integer[5]; a[0] = 23; a[1] = 8; a[2] = 19; a[3] = 9; a[4] = 1; Arrays.sort(a, new NewSort()); for (int i = 0; i < 5; i++) { System.out.print(a[i]); } System.out.println(); } } On Sat, Aug 13, 2011 at 3:39 PM, *$* wrote: > hi nikhil.. > correct ... just type error.. > but as per my algo .. as we need to consider the elements of original > array... the last element is 1 , but not 10. > > > > > On Sat, Aug 13, 2011 at 1:01 PM, Nikhil Veliath wrote: > >> @$ the ans should be 9823191 and not 98231910 >> >> On Sat, Aug 13, 2011 at 12:59 PM, Nikhil Veliath >> wrote: >> > @$ did not understand how the original array is sorted to give the >> number! >> > >> > On Sat, Aug 13, 2011 at 12:50 PM, *$* wrote: >> >> 1.scan the array and find the maximum digits of integer. lets say m.. >> >> 2.Again scan the array and pad the intergers whose digits are less that >> m (< >> >> m) with zero's .. copy the new integers in a new array >> >> 3.sort the new array in desc order and carry the same even for original >> >> array. >> >> 4. Now the original array contains the required output. >> >> ex: original aarray 23,8,19,9,1 >> >> >> >> max digits : 2 (for 23 as well as 19) >> >> step 2: new array 23,80,19,90,10 >> >> step3. sort .. 90,80,23,19,10 .. and corresponding original is .. >> 98231910. >> >> >> >> original array contains the original output.. >> >> >> >> >> >> >> >> On Sat, Aug 13, 2011 at 7:15 AM, chengjie qi >> wrote: >> >>> >> >>> int compare(int a, int b) { >> >>> string s = Integer.tostring(a); >> >>> string y = Integer.tostring(b); >> >>> if (s +y < y+s) >> >>>return -1; >> >>> else >> >>>return 1; >> >>> } >> >>> >> >>> use this to write quick sort , you can get the answer. >> >>> On Fri, Aug 12, 2011 at 8:34 PM, Yasir Imteyaz >> >>> wrote: >> >> An array of integers is given and you have to find the largest >> possible >> integer by concatenating all elements: >> example: >> array: 87 36 52 >> answer: 875236 >> array: 87 9 52 >> answer: 98752 >> >> -- >> You received this message because you are subscribed to the Google >> Groups >> "Algorithm Geeks" group. >> To view this discussion on the web visit >> https://groups.google.com/d/msg/algogeeks/-/_lJJOlRG_ukJ. >> To post to this group, send email to algogeeks@googlegroups.com. >> To unsubscribe from this group, send email to >> algogeeks+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. >> >>> >> >>> >> >>> >> >>> -- >> >>> stay hungry stay foolish >> >>> Chengjie Qi >> >>> >> >>> >> >>> -- >> >>> You received this message because you are subscribed to the Google >> Groups >> >>> "Algorithm Geeks" group. >> >>> To post to this group, send email to algogeeks@googlegroups.com. >> >>> To unsubscribe from this group, send email to >> >>> algogeeks+unsubscr...@googlegroups.com. >> >>> For more options, visit this group at >> >>> http://groups.google.com/group/algogeeks?hl=en. >> >> >> >> >> >> >> >> -- >> >> Thx, >> >> --Gopi >> >> >> >> -- >> >> You received this message because you are subscribed to the Google >> Groups >> >> "Algorithm Geeks" group. >> >> To post to this group, send email to algogeeks@googlegroups.com. >> >> To unsubscribe from this group, send email to >> >> algogeeks+unsubscr...@googlegroups.com. >> >> For more options, visit this group at >> >> http://groups.google.com/group/algogeeks?hl=en. >> >> >> > >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To post to this group, send email to algogeeks@googlegroups.com. >> To unsubscribe from this group, send email to >> algogeeks+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. >> >> > > > -- > Thx, > --Gopi > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- stay hungry stay foolish Chengjie Qi -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.
Re: [algogeeks] an array question
hi nikhil.. correct ... just type error.. but as per my algo .. as we need to consider the elements of original array... the last element is 1 , but not 10. On Sat, Aug 13, 2011 at 1:01 PM, Nikhil Veliath wrote: > @$ the ans should be 9823191 and not 98231910 > > On Sat, Aug 13, 2011 at 12:59 PM, Nikhil Veliath wrote: > > @$ did not understand how the original array is sorted to give the > number! > > > > On Sat, Aug 13, 2011 at 12:50 PM, *$* wrote: > >> 1.scan the array and find the maximum digits of integer. lets say m.. > >> 2.Again scan the array and pad the intergers whose digits are less that > m (< > >> m) with zero's .. copy the new integers in a new array > >> 3.sort the new array in desc order and carry the same even for original > >> array. > >> 4. Now the original array contains the required output. > >> ex: original aarray 23,8,19,9,1 > >> > >> max digits : 2 (for 23 as well as 19) > >> step 2: new array 23,80,19,90,10 > >> step3. sort .. 90,80,23,19,10 .. and corresponding original is .. > 98231910. > >> > >> original array contains the original output.. > >> > >> > >> > >> On Sat, Aug 13, 2011 at 7:15 AM, chengjie qi > wrote: > >>> > >>> int compare(int a, int b) { > >>> string s = Integer.tostring(a); > >>> string y = Integer.tostring(b); > >>> if (s +y < y+s) > >>>return -1; > >>> else > >>>return 1; > >>> } > >>> > >>> use this to write quick sort , you can get the answer. > >>> On Fri, Aug 12, 2011 at 8:34 PM, Yasir Imteyaz > >>> wrote: > > An array of integers is given and you have to find the largest > possible > integer by concatenating all elements: > example: > array: 87 36 52 > answer: 875236 > array: 87 9 52 > answer: 98752 > > -- > You received this message because you are subscribed to the Google > Groups > "Algorithm Geeks" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/algogeeks/-/_lJJOlRG_ukJ. > To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > >>> > >>> > >>> > >>> -- > >>> stay hungry stay foolish > >>> Chengjie Qi > >>> > >>> > >>> -- > >>> You received this message because you are subscribed to the Google > Groups > >>> "Algorithm Geeks" group. > >>> To post to this group, send email to algogeeks@googlegroups.com. > >>> To unsubscribe from this group, send email to > >>> algogeeks+unsubscr...@googlegroups.com. > >>> For more options, visit this group at > >>> http://groups.google.com/group/algogeeks?hl=en. > >> > >> > >> > >> -- > >> Thx, > >> --Gopi > >> > >> -- > >> You received this message because you are subscribed to the Google > Groups > >> "Algorithm Geeks" group. > >> To post to this group, send email to algogeeks@googlegroups.com. > >> To unsubscribe from this group, send email to > >> algogeeks+unsubscr...@googlegroups.com. > >> For more options, visit this group at > >> http://groups.google.com/group/algogeeks?hl=en. > >> > > > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > > -- Thx, --Gopi -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] an array question
@$ the ans should be 9823191 and not 98231910 On Sat, Aug 13, 2011 at 12:59 PM, Nikhil Veliath wrote: > @$ did not understand how the original array is sorted to give the number! > > On Sat, Aug 13, 2011 at 12:50 PM, *$* wrote: >> 1.scan the array and find the maximum digits of integer. lets say m.. >> 2.Again scan the array and pad the intergers whose digits are less that m (< >> m) with zero's .. copy the new integers in a new array >> 3.sort the new array in desc order and carry the same even for original >> array. >> 4. Now the original array contains the required output. >> ex: original aarray 23,8,19,9,1 >> >> max digits : 2 (for 23 as well as 19) >> step 2: new array 23,80,19,90,10 >> step3. sort .. 90,80,23,19,10 .. and corresponding original is .. 98231910. >> >> original array contains the original output.. >> >> >> >> On Sat, Aug 13, 2011 at 7:15 AM, chengjie qi wrote: >>> >>> int compare(int a, int b) { >>> string s = Integer.tostring(a); >>> string y = Integer.tostring(b); >>> if (s +y < y+s) >>> return -1; >>> else >>> return 1; >>> } >>> >>> use this to write quick sort , you can get the answer. >>> On Fri, Aug 12, 2011 at 8:34 PM, Yasir Imteyaz >>> wrote: An array of integers is given and you have to find the largest possible integer by concatenating all elements: example: array: 87 36 52 answer: 875236 array: 87 9 52 answer: 98752 -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/_lJJOlRG_ukJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. >>> >>> >>> >>> -- >>> stay hungry stay foolish >>> Chengjie Qi >>> >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "Algorithm Geeks" group. >>> To post to this group, send email to algogeeks@googlegroups.com. >>> To unsubscribe from this group, send email to >>> algogeeks+unsubscr...@googlegroups.com. >>> For more options, visit this group at >>> http://groups.google.com/group/algogeeks?hl=en. >> >> >> >> -- >> Thx, >> --Gopi >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To post to this group, send email to algogeeks@googlegroups.com. >> To unsubscribe from this group, send email to >> algogeeks+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. >> > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] an array question
@$ did not understand how the original array is sorted to give the number! On Sat, Aug 13, 2011 at 12:50 PM, *$* wrote: > 1.scan the array and find the maximum digits of integer. lets say m.. > 2.Again scan the array and pad the intergers whose digits are less that m (< > m) with zero's .. copy the new integers in a new array > 3.sort the new array in desc order and carry the same even for original > array. > 4. Now the original array contains the required output. > ex: original aarray 23,8,19,9,1 > > max digits : 2 (for 23 as well as 19) > step 2: new array 23,80,19,90,10 > step3. sort .. 90,80,23,19,10 .. and corresponding original is .. 98231910. > > original array contains the original output.. > > > > On Sat, Aug 13, 2011 at 7:15 AM, chengjie qi wrote: >> >> int compare(int a, int b) { >> string s = Integer.tostring(a); >> string y = Integer.tostring(b); >> if (s +y < y+s) >> return -1; >> else >> return 1; >> } >> >> use this to write quick sort , you can get the answer. >> On Fri, Aug 12, 2011 at 8:34 PM, Yasir Imteyaz >> wrote: >>> >>> An array of integers is given and you have to find the largest possible >>> integer by concatenating all elements: >>> example: >>> array: 87 36 52 >>> answer: 875236 >>> array: 87 9 52 >>> answer: 98752 >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "Algorithm Geeks" group. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msg/algogeeks/-/_lJJOlRG_ukJ. >>> To post to this group, send email to algogeeks@googlegroups.com. >>> To unsubscribe from this group, send email to >>> algogeeks+unsubscr...@googlegroups.com. >>> For more options, visit this group at >>> http://groups.google.com/group/algogeeks?hl=en. >> >> >> >> -- >> stay hungry stay foolish >> Chengjie Qi >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To post to this group, send email to algogeeks@googlegroups.com. >> To unsubscribe from this group, send email to >> algogeeks+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. > > > > -- > Thx, > --Gopi > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] an array question
1.scan the array and find the maximum digits of integer. lets say m.. 2.Again scan the array and pad the intergers whose digits are less that m (< m) with zero's .. copy the new integers in a new array 3.sort the new array in desc order and carry the same even for original array. 4. Now the original array contains the required output. ex: original aarray 23,8,19,9,1 max digits : 2 (for 23 as well as 19) step 2: new array 23,80,19,90,10 step3. sort .. 90,80,23,19,10 .. and corresponding original is .. 98231910. original array contains the original output.. On Sat, Aug 13, 2011 at 7:15 AM, chengjie qi wrote: > int compare(int a, int b) { > string s = Integer.tostring(a); > string y = Integer.tostring(b); > if (s +y < y+s) >return -1; > else >return 1; > } > > > use this to write quick sort , you can get the answer. > > On Fri, Aug 12, 2011 at 8:34 PM, Yasir Imteyaz wrote: > >> An array of integers is given and you have to find the largest possible >> integer by concatenating all elements: >> >> example: >> array: 87 36 52 >> answer: 875236 >> >> array: 87 9 52 >> answer: 98752 >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To view this discussion on the web visit >> https://groups.google.com/d/msg/algogeeks/-/_lJJOlRG_ukJ. >> To post to this group, send email to algogeeks@googlegroups.com. >> To unsubscribe from this group, send email to >> algogeeks+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. >> > > > > -- > stay hungry stay foolish > Chengjie Qi > > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- Thx, --Gopi -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] an array question
int compare(int a, int b) { string s = Integer.tostring(a); string y = Integer.tostring(b); if (s +y < y+s) return -1; else return 1; } use this to write quick sort , you can get the answer. On Fri, Aug 12, 2011 at 8:34 PM, Yasir Imteyaz wrote: > An array of integers is given and you have to find the largest possible > integer by concatenating all elements: > > example: > array: 87 36 52 > answer: 875236 > > array: 87 9 52 > answer: 98752 > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/algogeeks/-/_lJJOlRG_ukJ. > To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- stay hungry stay foolish Chengjie Qi -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] an array question
I think tis works On Fri, Aug 12, 2011 at 6:16 PM, Nitin Nizhawan wrote: > radix sort the digits wrong way (left most digit first), and then > concatenate > > > On Fri, Aug 12, 2011 at 6:12 PM, Yasir wrote: > >> Kindly check it with both the examples. It won't work. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To view this discussion on the web visit >> https://groups.google.com/d/msg/algogeeks/-/VlT1DNH-vPkJ. >> >> To post to this group, send email to algogeeks@googlegroups.com. >> To unsubscribe from this group, send email to >> algogeeks+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. >> > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] an array question
I have use bactracking http://codepad.org/rF4Sr3zk it works for only 1 and 2digit number On Fri, Aug 12, 2011 at 6:04 PM, Yasir Imteyaz wrote: > An array of integers is given and you have to find the largest possible > integer by concatenating all elements: > > example: > array: 87 36 52 > answer: 875236 > > array: 87 9 52 > answer: 98752 > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/algogeeks/-/_lJJOlRG_ukJ. > To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] an array question
use something like radix sort, but from numbers left to right. in given example: 87 36 52 87 36 52 place 87 then 52 than 36 if input is something like 9 87 36 52 place 9875236 this you can do with minor modification of radix sort. thanks Rajesh On Fri, Aug 12, 2011 at 6:31 PM, Abhishek Gupta wrote: > see the second example...if a single digit is there...tht will be at the > very end of the array...and if it is 9 it must come at first place...there > it goes wrong... > > On Fri, Aug 12, 2011 at 6:23 PM, Prem Krishna Chettri > wrote: >> >> Amazing , >> Kindly Follow me up :- >> >> 1> Given Array of Random Value ... say int a[]= >> {20,365,299,50,67,21}; >> Apply Any Sorting Algo on it... which Results into somewhat >> like a={365,299,67,50,21,20,.. blah..}... >> 2> Well No U hv to put those values to a string variable. >> Please lemme knw if I need more clarification.. This is simple where is >> the messy part?? >> >> >> >> On Fri, Aug 12, 2011 at 6:16 PM, Nitin Nizhawan >> wrote: >>> >>> radix sort the digits wrong way (left most digit first), and then >>> concatenate >>> >>> On Fri, Aug 12, 2011 at 6:12 PM, Yasir wrote: Kindly check it with both the examples. It won't work. -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/VlT1DNH-vPkJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "Algorithm Geeks" group. >>> To post to this group, send email to algogeeks@googlegroups.com. >>> To unsubscribe from this group, send email to >>> algogeeks+unsubscr...@googlegroups.com. >>> For more options, visit this group at >>> http://groups.google.com/group/algogeeks?hl=en. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To post to this group, send email to algogeeks@googlegroups.com. >> To unsubscribe from this group, send email to >> algogeeks+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. > > > > -- > Thanks & Regards > Abhishek Gupta > BITS, Pilani > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] an array question
see the second example...if a single digit is there...tht will be at the very end of the array...and if it is 9 it must come at first place...there it goes wrong... On Fri, Aug 12, 2011 at 6:23 PM, Prem Krishna Chettri wrote: > Amazing , > > Kindly Follow me up :- > > > 1> Given Array of Random Value ... say int a[]= {20,365,299,50,67,21}; > Apply Any Sorting Algo on it... which Results into somewhat > like a={365,299,67,50,21,20,.. blah..}... > > 2> Well No U hv to put those values to a string variable. > >Please lemme knw if I need more clarification.. This is simple where is > the messy part?? > > > > > On Fri, Aug 12, 2011 at 6:16 PM, Nitin Nizhawan > wrote: > >> radix sort the digits wrong way (left most digit first), and then >> concatenate >> >> >> On Fri, Aug 12, 2011 at 6:12 PM, Yasir wrote: >> >>> Kindly check it with both the examples. It won't work. >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "Algorithm Geeks" group. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msg/algogeeks/-/VlT1DNH-vPkJ. >>> >>> To post to this group, send email to algogeeks@googlegroups.com. >>> To unsubscribe from this group, send email to >>> algogeeks+unsubscr...@googlegroups.com. >>> For more options, visit this group at >>> http://groups.google.com/group/algogeeks?hl=en. >>> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To post to this group, send email to algogeeks@googlegroups.com. >> To unsubscribe from this group, send email to >> algogeeks+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. >> > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- Thanks & Regards Abhishek Gupta BITS, Pilani -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] an array question
Amazing , Kindly Follow me up :- 1> Given Array of Random Value ... say int a[]= {20,365,299,50,67,21}; Apply Any Sorting Algo on it... which Results into somewhat like a={365,299,67,50,21,20,.. blah..}... 2> Well No U hv to put those values to a string variable. Please lemme knw if I need more clarification.. This is simple where is the messy part?? On Fri, Aug 12, 2011 at 6:16 PM, Nitin Nizhawan wrote: > radix sort the digits wrong way (left most digit first), and then > concatenate > > > On Fri, Aug 12, 2011 at 6:12 PM, Yasir wrote: > >> Kindly check it with both the examples. It won't work. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To view this discussion on the web visit >> https://groups.google.com/d/msg/algogeeks/-/VlT1DNH-vPkJ. >> >> To post to this group, send email to algogeeks@googlegroups.com. >> To unsubscribe from this group, send email to >> algogeeks+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. >> > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] an array question
radix sort the digits wrong way (left most digit first), and then concatenate On Fri, Aug 12, 2011 at 6:12 PM, Yasir wrote: > Kindly check it with both the examples. It won't work. > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/algogeeks/-/VlT1DNH-vPkJ. > > To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] an array question
Kindly check it with both the examples. It won't work. -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/VlT1DNH-vPkJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] an array question
1> Sort the Array 2> Put it to the String Accordingly.. Prem On Fri, Aug 12, 2011 at 6:04 PM, Yasir Imteyaz wrote: > An array of integers is given and you have to find the largest possible > integer by concatenating all elements: > > example: > array: 87 36 52 > answer: 875236 > > array: 87 9 52 > answer: 98752 > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/algogeeks/-/_lJJOlRG_ukJ. > To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] an array question
An array of integers is given and you have to find the largest possible integer by concatenating all elements: example: array: 87 36 52 answer: 875236 array: 87 9 52 answer: 98752 -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/_lJJOlRG_ukJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.