Search a Linked List

Searching a linked list for a particular item is just a matter of testing each item to see if it is the target value while the linked list is being traversed.  This can be done according to the pseudocode below:

ptr = Start

WHILE ptr <> 0
        IF Data(ptr) = sought item THEN
                Found = TRUE
                EXIT WHILE
        ELSE
                ptr = Next(ptr)
        END IF
END WHILE

IF Found = TRUE THEN
        OUTPUT Data(ptr)
END IF