Data Structure

Linear Search

learn datastructure by example of linear search algorithm

4/17/2021
0 views
linear-search-algorithm.cC
# Input: Array D, integer key
# Output: first index of key in D, 
# or -1 if not found

For i = 0 to last index of D:
	if D[i] equals key:
		return i
return -1
data structurealgorithmlinear search algorithmlinear search

Loading comments...

Related Examples