What is the time complexity of the linear search algorithm in the worst case?

  • O(1)
  • O(log n)
  • O(n)
  • O(n^2)
The linear search algorithm has a worst-case time complexity of O(n) because in the worst scenario, it needs to iterate through the entire array to find the target element.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *