Follow

Translate

Sunday, March 20, 2016

Searching A LINK LIST



1.   Set PTR: = START

2.  Repeat Step 3 while PTR != NULL:

3.   If ITEM < INFO[PTR], then:
    
        Set PTR : = LINK[PTR].     [PTR now points to the next node.]
Else if ITEM = INFO[PTR], then:
Set LOC : = PTR, and Exit.     [Search is successful.]

Else:
Set LOC : = NULL, and Exit.      [ITEM now exceeds INFO[PTR].] 

    [End of If Structure]
[End of Step 2 loop]

4.   Set LOC : = NULL.

5.Exit

0 comments:

Post a Comment