• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests

Top MCQs on Complexity Analysis of Algorithms with Answers

Question 111

The following statement is valid. log(n!) = [Tex]\\theta [/Tex](n log n).

  • True

  • False

Question 112

Which of the following is not true about comparison-based sorting algorithms?

  • The minimum possible time complexity of a comparison-based sorting algorithm is O(n(log(n)) for a random input array

  • Any comparison based sorting algorithm can be made stable by using position as a criteria when two elements are compared

  • Counting Sort is not a comparison based sorting algorithm

  • Heap Sort is not a comparison based sorting algorithm.

Question 113

Which of the following is not O(n2)?

  • (15) * n2

  • n1.98

  • n3/(sqrt(n))

  • (20) * n2

Question 114

If we use Radix Sort to sort n integers in the range (nk/2,nk], for some k>0 which is independent of n, the time taken would be?

  • Θ(n)

  • Θ(kn)

  • Θ(nlogn)

  • Θ(n2)

Question 115

A problem in NP is NP-complete if  

  • It can be reduced to the 3-SAT problem in polynomial time

  • The 3-SAT problem can be reduced to it in polynomial time

  • It can be reduced to any other problem in NP in polynomial time

  • Some problem in NP can be reduced to it in polynomial time

Question 116

Which one of the following statements is TRUE for all positive functions f (n)?

  • [Tex]f(n^{2}) = \theta (f(n^{2}))  [/Tex], when f (n) is a polynomial

  • [Tex]f(n^{2}) = o (f(n^{2}))[/Tex]

  • [Tex]f(n^{2}) = O(f(n^{2}))  [/Tex], when f (n) is an exponential function

  • [Tex]f(n^{2}) = Ω(f(n^{2}))[/Tex]

Question 117

What is the time complexity of the following function?

void A (int n)
{
         int i, j, k;
         for (i=1; i<=n; i++)
             {
                  for (j =1; j <=i; j++)
                        {
                              for (k =1; k< = 133; k++)
                                       {
                                             X=Y+Z;
                                        }
                         }
               }
}
 

  • n^3

  • nlogn

  • n^2

  • loglogn

Question 118

O(n) is the worst case time complexity, so among the given options it can represent :-

  • O(n^2)

  • O(1)

  • O(nlogn)

  • None of the above

There are 118 questions to complete.

Last Updated :
Take a part in the ongoing discussion