What is the worst-case time complexity of linear search in an unsorted array of n elements?

Options

  • A. O(1)
  • B. O(log n)
  • C. O(n)
  • D. More than one of the above
  • E. None of the above

Correct Answer (Detailed Explanation is Below)

C. O(n)

Detailed Explanation

Linear Search examines elements one by one until the required value is found or the entire array has been checked. In the worst case, the desired element is at the last position or is not present, so all n elements must be examined. Therefore, the worst-case complexity is O(n). The best case is O(1), when the target is found at the first position. Unlike Binary Search, Linear Search does not require the array to be sorted.