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

  • O(1)
  • O(log n)
  • O(n)
  • O(n^2)
In the worst case, a linear search algorithm has a time complexity of O(n). This means that in the worst-case scenario, where the element being searched for is at the end of the list or array, the algorithm may need to examine every element in the list before finding the target.
Add your answer
Loading...

Leave a comment

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