0

I have a recursive function:

void review_func(double val){
   if(val>=1.0){
      review_func(val/2.0)
   }
}

I was able to solve its time complexity using induction and the master theorem. However I am pretty doubtful about the result I got from using induction my solution is shown below: enter image description here

I am reviewing for my exam and I am quite struggling with time and space complexities any help and tip would be greatly appreciated.

Monsi
  • 43
  • 5
  • I think https://cs.stackexchange.com is probably a more appropriate place to ask this question. You will get better answers there. – nick Mar 16 '20 at 05:10
  • 2
    The time complexity for the posted code will be `O(log(N))`. I am not sure why you think it will be `O(N)`. – R Sahu Mar 16 '20 at 05:22
  • It will be `O(n)` if `T(n) = 2T(n/2)`, if not it's just O(log n) – Wander3r Mar 16 '20 at 05:24

0 Answers0