📢 Too many exams? Don’t know which one suits you best? Book Your Free Expert 👉 call Now!


    âš¡ Month End Offer - Flat 52% Off On All Courses! Enroll Now âš¡
    00:00:00 AM Left

    Question

    calculate the complexity of the below recursive

    code Int f(int n) { If(n return 1; return f(n/2)+f(n/2); }
    A T(n)= 2T(n/2)+O(1) Correct Answer Incorrect Answer
    B T(n)= T(n/2)+O(1) Correct Answer Incorrect Answer
    C T(n)= 2T(n/4)+O(1) Correct Answer Incorrect Answer
    D T(n)= 2T(n/6)+O(1) Correct Answer Incorrect Answer
    E none Correct Answer Incorrect Answer

    Solution

    Here the function is recursively calling on f(n/2) twice and also one line for the condition when n=0. Hence 1 is the correct choice.

    Practice Next
    ask-question