Data Structure Time Complexity Question #15259
MCQ Single Best Answer Easy

QWhat is the time complexity of a linear search algorithm for finding the maximum element in an unsorted array of n elements?

ID: #15259 Time Complexity 144 views
Question Info
#15259Q ID
EasyDifficulty
Time ComplexityTopic

Choose the Best Option

Click any option to instantly check if you're correct.

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

Explanation

In a linear search algorithm for finding the maximum element in an unsorted array, each element is checked sequentially to determine the maximum. In the worst case, the maximum element is located at the end of the array, requiring n comparisons. Therefore, the time complexity of the linear search for finding the maximum element is linear, denoted as O(n).

Share This Question

Challenge a friend or share with your study group.