VOOZH about

URL: https://www.geeksforgeeks.org/quizzes/quiz-on-complexity-analysis-for-dsa/

⇱ Quiz about Complexity Analysis Quiz


Last Updated :
Discuss
Comments

Question 1

Which of the following best represents the time complexity of accessing an element in an array by its index?

  • O(1)

  • O(n)

  • O(log n)

  • O(n^2)

Question 2

What is the time complexity of a nested loop where the outer loop runs n times and the inner loop runs m times?

  • O(n)

  • O(m)

  • O(n * m)

  • O(n + m)

Question 3

Consider an algorithm that takes an array of size n and performs a loop from 1 to n^2. What is the time complexity of this algorithm?

  • O(n)

  • O(n2)

  • O(n3)

  • O(n4)

Question 4

Which of the following is true about the Big O notation (O(f(n)))?

  • It describes the lower bound of the runtime of an algorithm.

  • It describes the exact runtime of an algorithm.

  • It describes the upper bound of the runtime of an algorithm.

  • It describes the average runtime of an algorithm.

Question 5

Which of the following options correctly matches the notation with the parameters they define

  • Big-O Notation (O-notation) : Average Case complexity

    Omega Notation (Ω-notation) : Worst Case complexity

    Theta Notation (Θ-notation) : Best Case complexity

  • Big-O Notation (O-notation) : Best Case complexity

    Omega Notation (Ω-notation) : Average Case complexity

    Theta Notation (Θ-notation) : Worst Case complexity

  • Big-O Notation (O-notation) : Worst Case complexity

    Omega Notation (Ω-notation) : Average Case complexity

    Theta Notation (Θ-notation) : Best Case complexity

  • Big-O Notation (O-notation) : Worst Case complexity

    Omega Notation (Ω-notation) : Best Case complexity

    Theta Notation (Θ-notation) : Average Case complexity

Question 6

If an algorithm’s time complexity is O(n^2), which of the following best describes its performance when the input size is doubled?

  • The time taken will double.

  • The time taken will remain the same.

  • The time taken will increase by a factor of 2^2.

  • The time taken will quadruple.

Question 7

What does O(n) time complexity indicate in an algorithm?

  • The algorithm's execution time grows exponentially with the input size.

  • The algorithm's execution time grows linearly with the input size.

  • The algorithm’s execution time does not depend on the input size.

  • The algorithm’s execution time is constant, irrespective of the input size.

Question 8

Determine the time complexity for the following recursive function :


  • O(n)

  • O(log n)

  • O(2^n)

  • O(n^2)

Question 9

What is the time complexity of the following recursive function?
Note : The merge function takes linear time.


  • O(log n)

  • O(n log n)

  • O(n^2)

  • O(n)

Question 10

Consider a recursive function with a branching factor of 3 and a depth of recursion of n. What would be the time complexity of this recursion?

  • O(3n)

  • O(n3)

  • O(3n)

  • O(n2)

Tags:

There are 17 questions to complete.

Take a part in the ongoing discussion