how come its printing in sorted ... i didn't get it...

On Thu, Jun 23, 2011 at 12:27 AM, oppilas . <jatka.oppimi...@gmail.com>wrote:

> No, it will not work. We don't have to print all the characters in sorted
> order.
>
> On Thu, Jun 23, 2011 at 12:19 AM, snehi jain <snehijai...@gmail.com>wrote:
>
>> what if we create a binary tree with root as the first element of the
>> string and if the next character is equal then place it to left else place
>> it to right. Similar comparison will be done while inserting all the other
>> nodes too .
>>
>> after that if InOrder traversal is performed.. it would give us the
>> desired output.
>>
>> i didnt code it ... but it sounds ok to me..
>> correct me if i am wrong ..
>>
>>
>> Snehi
>>
>>
>> On Wed, Jun 22, 2011 at 9:48 PM, DK <divyekap...@gmail.com> wrote:
>>
>>> No. This is equivalent to a sort with comparisons based on index of first
>>> occurrence in the input string. Any comparative algorithm is O(n log n) and
>>> a non comparative algorithm can be O(n) only by using counting or radix
>>> sorting etc.
>>>
>>> --
>>> DK
>>>
>>> http://twitter.com/divyekapoor
>>> http://www.divye.in
>>>
>>> --
>>> 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/-/GeqwF_snzQQJ.
>>> 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.
>

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