10
025
130
245
350
465
570
685
790
81x
Algorithm Details
Time Complexity
BestO(1)
AverageO(n)
WorstO(n)
Checks each element sequentially until the target is found or the end is reached.
Algorithm Logic
1Algorithm LinearSearch(array, target):
2 For each index i from 0 to length - 1:
3 If array[i] == target:
4 Return i (Found)
5
6 Return -1 (Not Found)