@above.. just to add to the above post... L(n) is basically reordering of the elements of A[n] which would produce the largest possible integer when read from L(0) to L(n).
On Dec 12, 11:07 pm, Lucifer <sourabhd2...@gmail.com> wrote: > Thinking on the same lines: > > 1) First sort the array in descending order.. A[n] > > 2) Use the following equation solve the prob: > L(n) = the largest no. that can be formed by placing the A[n] in > (n-2) possible positions of L(n-1)... > > Complexity : O(nlogn) + O(n^2) > > What do u guys think? > > On Dec 12, 10:23 pm, KAY <amulya.manches...@gmail.com> wrote: > > > > > > > > > @sravan- Sorting would fail in this case: > > consider 8,91, 9 > > sorting in desc order is going to give us 91, 9, 8. > > printing this is going to give us 9198. > > However, a bigger number can be formed 9891. > > > After sorting lexicographically, we have to consider whether tied > > elements in list can be combined with other elements such that the new > > number is bigger than the lexicographically biggest number... > > for eg, 91,9,8, > > 91 and 9 are tied because the most significant digit is the same 9. > > now is there any single digit number in the sorted list(because 91 is > > 2 digits long), such that when concatenated with 9, gives a number > > bigger than 91(which is head of the list)...... > > if u think carefully, this single digit number would have to be the > > next single digit number in the sorted list........... > > > Can this algo be improved? > > > On Dec 12, 9:00 pm, Lucifer <sourabhd2...@gmail.com> wrote: > > > > +1 @sravan > > > > On Dec 12, 8:55 pm, sravanreddy001 <sravanreddy...@gmail.com> wrote: > > > > > Sort the numbers based on the 'index_position' (starting at most > > > > significat > > > > digit) -- a modified version of MSD radix to be used. > > > > > or sort the numbers as sorting the strings, (print all in desc > > > > order).- Hide quoted text - > > > > - Show quoted text - -- 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.