Write an algorithm to search for an ITEM in a linked list.

This is an algorithm to search for an ITEM in a linked list.

1.	ptr = start 
2.	repeat steps 3 through 7 until ptr = NULL 
3.	if ptr -> into = ITEM then 
4.	loc = ptr 
5.	else 
6.	loc = NULL 
7.	ptr = ptr -> link 
8.	if loc = NULL then 
9.	print "Not found" 
10.	else print "found at", loc 

Leave a Comment