List Search
Let H be a pointer to a linked list of nodes. Let v be the data value we’re looking for. Let P be a variable whose value is a pointer to a node.
Interative solution:
P := H
While P != null
If P.info = v then
Return P
else P := P.link
Return P
Recursive solution:
P := H
If P = null or P.info = v then
Return P
Else return search(P.link, v)
Previous slide
Next slide
Back to first slide
View graphic version