Linear Search Visualization
How Linear Search Works
Linear Search is the simplest search algorithm. It sequentially checks each element of the list until a match is found or the whole list has been searched. While it's not the most efficient for large datasets, it's easy to implement and works on unsorted lists.
function linearSearch(array, target):
for i from 0 to array.length - 1:
if array[i] == target:
return i
visualize(array, i)
return -1