GATE CSE
First time here? Checkout the FAQ!
x
0 votes
140 views
Stack space used in binary search resursive implementation.
asked in Algorithms by Boss (6k points)   | 140 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 Mar 2017
  1. rude

    5128 Points

  2. sh!va

    3054 Points

  3. Rahul Jain25

    2920 Points

  4. Kapil

    2732 Points

  5. Debashish Deka

    2602 Points

  6. 2018

    1574 Points

  7. Vignesh Sekar

    1422 Points

  8. Akriti sood

    1386 Points

  9. Bikram

    1350 Points

  10. Sanjay Sharma

    1128 Points

Monthly Topper: Rs. 500 gift card

21,535 questions
26,867 answers
61,199 comments
23,218 users