I am assuming that the median is the sum of all the values stored in the
nodes divided by 2.

So I am traversing all the nodes recursively....and finding the median of
them.

On Mon, Mar 28, 2011 at 5:12 PM, kunal srivastav <kunal.shrivas...@gmail.com
> wrote:

> median is defined for a sorted list of numbers.. i cannot understand how
> you can traverse in O(n) in a normal binary tree.
>
> @raunak plz explain the solution
>
>
> On Mon, Mar 28, 2011 at 4:16 PM, bittu <shashank7andr...@gmail.com> wrote:
>
>> @all try to understand the question as usual we have to do it in min.
>> time & space complexity ..in mean Time O(n) & space o(1) At-most
>> just tell em after doing in-order traversal where u will store the
>> elements either in array or in set isn'tit  it will take O(n) extra
>> space why not looks fro O(1) SPACE..IF M NOT CORRECT otherwise problem
>> just become finding median in array which O(1) ..correct me if m
>> wrong
>>
>> @Anurag wher u will store inorder of tree
>>
>>
>> Thanks
>> Shashank
>>
>> --
>> 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.
>>
>>
>
>
> --
> thezeitgeistmovement.com
>
> --
> 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