Data Structure - Searching a linked list algorithm
Searching a linked list
Algorithm
- Set ptr:=start
- Repeat while ptr!=null.(ptr is not equal to null.)
- if item=INFO[ptr], then
print "Found"
[end of if structure.] - Set ptr:=link[ptr].
[end of loop] - [Search unsuccessful]
print "Not found" - Exit.
Comments
Post a Comment