soln 1) [Using space & other data structure ]  do inorder traversal, store
the values into an array (as there is no other constraint). find array
length. If array length is odd, return array[(odd+1)/2]; else (
array[even/2] + array[even/2+1] ) / 2 )

soln 2) do inorder traversal, get the total count. do inorder traversal
again, if count is odd return (n+1)/2th element; else return avg of (n/2)th
element + (n/2+1)th element.

On Mon, Jun 21, 2010 at 5:52 PM, Piyush Verma <[email protected]> wrote:

> do inorder traversal and reverse-inorder traversal if nodes value is same
> then it is median
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<algogeeks%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
cheers
Jeeva

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to