Linear Search
Linear Search
K 70
=
Step 2: Comparing key with next element L[1].
SInce not equal, the iterator moves to the next
element as a potential match.
10 50 70 20 40 30
K 70
Step 2: Now when comparing L[2] with key, the value
matches. So the Linear Search Algorithm will yield a
successful message and return the index of the element when
key is found (here 2).
10 50 70 20 40 30
K 70
10 50 70 20 40 30
K K K=
=
= 70 70 70