[Home]Linear search/Talk

HomePage | Linear search | Recent Changes | Preferences

Pseudocode implementation:

Linear search looks like the following in pseudocode:

Input is a list L and a value V. L[x] will denote the xth element in L, which consists of N values, L[1], L[2], ..., L[N].

function linear-search(L,N,V)

	set index = 1
	repeat while index <= N
		if L[index] = V
			return success
		end-if
		set index = index + 1
	end-repeat
	return failure
end-function

HomePage | Linear search | Recent Changes | Preferences
This page is read-only | View other revisions
Last edited December 13, 2001 4:23 am by Taw (diff)
Search: