@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.

Reply via email to