• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests

Top MCQs on Complexity Analysis using Recurrence Relations with Answers

Question 21

When n = 22k for some k ≥ 0, the recurrence relation
T(n) = √(2) T(n/2) + √n, T(1) = 1
evaluates to :

  • √(n) (log n + 1)

  • √(n) (log n )

  • √(n) log √(n)

  • n log √(n)

Question 22

Let T(n) be the function defined by T(1)= 1, T(n)= 2T (⌊n/2⌋) + √n  for n≥2. Which of the following statement(s) is true? a.  T(n) = O(√n) b.  T(n) = O(n) c.  T(n) = O(log n) d. None of the above
  • a
  • b
  • c
  • d

Question 23

Consider the following function
Function F (n, m: integer): integer;
begin
    If (n<=0) or (m<=0) then F:=1
    else
      F:= F(n-1,m) + F(n, m-1);
    end;
Use the recurrence relation to answer the following question. asdf         Assume that n, m are positive integers. Write only the answers without any explanation. a. What is the value of F(n,2)? b. What is the value of (n,m)? c. How many recursive calls are made to the function F, including the original call, when evaluating F(n,m).

    Question 24

    The recurrence relation

     T(1) = 2
     T(n) = 3T(n/4)+n
    

    has the solution, T(n) equals to

    • O(n)

    • O(log n)

    • O(n^3/4)

    • None of the above

    Question 25

    Match the following and choose the correct answer in the order A, B, C
    A. Heap Construction p. O(n log n)
    B. Hash table construction with linear probing q. O(n2)
    C. AVL Tree construction r. O(n)
    (Bounds given may or may not be asymptotically tight)
    • q, r, p
    • p, q, r
    • q, p, r
    • r, q, p

    Question 26

    Consider the following recurrence: T(n) = 2T(n1/2) + 1 T(1) = 1 Which of the following is true?

    • T(n)= O(log log n)

    • T(n) = O(log n)

    • T(n) = O(n1/2)

    • T(n)= O(n)

    Question 27

    What is the time complexity for the following C module? Assume that n>0 . int module(int n) { if (n == 1) return 1; else return (n + module(n-1)); }
    • O(n)
    • O(log n)
    • O(n2)
    • O(n!)

    Question 28

    The running time of an algorithm is given by
    T(n) = T(n-1) + T(n-2) — T(n-3), if n > 3
         = n, otherwise
    
    Then what should be the relation between T(1), T(2) and T(3), so that the order of the algorithm is constant ?
    • T(1) = T(2) = T(3)
    • T(1) + T(3) = 2 * T(2)
    • T(1) - T(3) = T(2)
    • T(1) + T(2) = T(3)

    Question 29

    Consider the following recurrence relation. Which one of the following options is correct?
    • T(n) = Θ(n5/2)
    • T(n) = Θ(nlogn)
    • T(n) = Θ(n)
    • T(n) = Θ((logn)5/2)

    Question 30

    What is the worst-case number of arithmetic operations performed by recursive binary search on a sorted array of size n?
    • Θ(√n)
    • Θ(log2(n))
    • Θ(n2)
    • Θ(n)

    There are 35 questions to complete.

    Last Updated :
    Take a part in the ongoing discussion