GATE CSE
First time here? Checkout the FAQ!
x
0 votes
104 views
Stack space used in binary search resursive implementation.
asked in Algorithms by Boss (5.3k points)   | 104 views
yes O(logn) recursion call stack space .
If we consider the tail recursion then?
then also , computer think that he have to do some work after function call retuen . so yes he take O(logn) space .

do iterative then O(1).
Ok... if in this case we want to minimise the stack space then is it possible in the recursive case ?
See recursive means we have to wait till function call return and call to another function so 1st call have to wait for last call . so no space not minimized . as i think

1 Answer

+1 vote
In case of recursive implementation, O(Logn) recursion call stack space.
answered by Active (1.3k points)  
Top Users Jan 2017
  1. Debashish Deka

    8126 Points

  2. sudsho

    5042 Points

  3. Habibkhan

    4706 Points

  4. Vijay Thakur

    4458 Points

  5. Bikram

    4348 Points

  6. saurabh rai

    4212 Points

  7. Arjun

    4010 Points

  8. santhoshdevulapally

    3722 Points

  9. GateSet

    3292 Points

  10. Sushant Gokhale

    3286 Points

Monthly Topper: Rs. 500 gift card

19,122 questions
24,033 answers
52,725 comments
20,276 users