big o - solving recurrence T(n) = T(n/2) + T(n/2 - 1) + n/2 + 2 -


need on solving runtime recurrence, using big-oh:

t(n) = t(n/2) + t(n/2 - 1) + n/2 + 2 

i don't quite how use master theorem here

for n big enough can assume t(n/2 - 1) == t(n/2), can change

  t(n) = t(n/2) + t(n/2 - 1) + n/2 + 2 

into

  t(n) = 2*t(n/2) + n/2 + 2 

and use master theorem (http://en.wikipedia.org/wiki/master_theorem) for

  t(n) = a*t(n/b) + f(n)    = 2   b = 2   f(n) = n/2 + 2   c = 1    k = 0    log(a, b) = 1 = c  

and have (case 2, since log(a, b) = c)

  t(n) = o(n**c * log(n)**(k + 1))   t(n) = o(n * log(n)) 

Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -