MCQ Practice Single Best Answer Topic: Time Complexity

Q What is the time complexity of a linear search algorithm for an unsorted array of n elements in the worst case?

Question ID
#15245
Subchapter
Time Complexity
Action
Choose one option below

Choose Your Answer

Click an option to check whether your answer is correct.

  • A O(1)
  • B O(log n)
  • C O(n)
  • D O(n^2)
Correct Answer: C

Explanation

In a linear search algorithm, each element of the array is checked one by one until the target element is found or the end of the array is reached. In the worst case, where the target element is at the last position or absent from the array, the algorithm will need to examine all n elements. Therefore, the time complexity of a linear search is linear, denoted as O(n).

Share This Question

Share this MCQ with your friends or study group.