quiz

Time Complexity of Algorithms

1. What is the term for the maximum time required for inputs of a given size?

  • A) Worst-case time complexity
  • B) Average-case time complexity
  • C) Best-case time complexity
  • D) Expected time complexity
A) Worst-case time complexity Explanation

2. Which algorithms are quasilinear in time complexity?

  • A) Bubble Sort
  • B) Insertion Sort
  • C) Randomized QuickSort
  • D) Selection Sort
C) Randomized QuickSort Explanation

3. What is the time complexity of the recursive function Fibonacci series?

int fib(int n) { if (n <= 1) return n; return fib(n - 1) + fib(n - 2); }  
  • A) O(n)
  • B) O(logn)
  • C) O(2n)
  • D) O(n2 )
C) O(2n) Explanation

4. What is the time complexity of a binary search method on a sorted list of length n?

  • A) O(1)
  • B) O(n)
  • C) O(log n)
  • D) O(n2)
C) O(log n) Explanation