The time complexity of linear search in the worst-case scenario is _______.
- O(1)
- O(log n)
- O(n)
- O(n^2)
The time complexity of linear search in the worst-case scenario is O(n), where 'n' is the number of elements in the array. This is because, in the worst case, the algorithm may need to traverse the entire array to find the desired element.
Loading...
Related Quiz
- The time complexity of the standard dynamic programming approach for Matrix Chain Multiplication is _______.
- Under what circumstances would you prefer to use Prim's algorithm over Kruskal's, and vice versa?
- Can DFS be used to detect cycles in an undirected graph?
- The longest common substring problem aims to find the _______ string that appears in two or more given strings.
- How does the load factor affect the performance of a hash table?