@saurabh : correct..yes if you are considering recursive approach , so it
will take O(n) space stack.But same can be done using Morris traversal then
space will be constant.

On Fri, Nov 9, 2012 at 7:40 AM, saurabh singh <saurab...@gmail.com> wrote:

> ^ To perform inorder traversal in  a binary tree without using stack space
> the tree must be mutable. In other cases as far as I can think the space
> complexity should be asymptotically O(n) where n are the number of nodes.
>
> Saurabh Singh
> B.Tech (Computer Science)
> MNNIT
> blog:geekinessthecoolway.blogspot.com
>
>
>
> On Wed, Nov 7, 2012 at 10:09 AM, atul anand <atul.87fri...@gmail.com>wrote:
>
>> @vaibhav : by not using extra space...i guess you mean that you were not
>> allowed to use one extra pointer.bcozz space complexity will remain
>> constant for inorder approch.
>>
>> On Tue, Nov 6, 2012 at 1:07 AM, vaibhav shukla 
>> <vaibhav200...@gmail.com>wrote:
>>
>>> yes ofcourse... dats the easiest i suppose...
>>> but in one of my interviews, i told this approach, but was then asked
>>> not to use space (which i was ,to store inorder)
>>> So for such cases, you must try other approaches as well. (DO
>>> inorder,keep track of previously visited node and compare it with current
>>> node for value greater,or less accordingly.)
>>>
>>>
>>> On Tue, Nov 6, 2012 at 12:34 AM, shady <sinv...@gmail.com> wrote:
>>>
>>>> Hi,
>>>> Can we check this by just doing an inorder traversal, and then checking
>>>> if it is in increasing order or not ?
>>>>
>>>> --
>>>> 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.
>>>>
>>>
>>>
>>>
>>> --
>>> best wishes!!
>>>  Vaibhav
>>>
>>>  --
>>> 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.
>

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