For the below function,

I did

But I must have did wrong … answer should be O(log n). I am terrible at Big O … havent fully understood master theorem which is not taught in school yet. They taught only recursion tree
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If we suppose that all arithmetic operations are done in O(1) then:
As we see each function call we divide exp on 2. When we reach zero with exp – we done.
How many times we can divide exp on two without reaching zero? That’s log exp. So the log exp function calls * O(1) gives log(exp) complexity.
Finding sum of geometric sequence you finding answer to another problem: how many node in complete (where all siblings exist) tree with n leaves:
suppose n = 4:
you are finding count of node in such a tree