Follow

Translate

Thursday, March 17, 2016

Traversing a linked List


The variable PTR points to the node currently being processed.

1.  Set PTR : = START .    [Initialize pointer PTR]

2.  Repeat Steps 3 and 4 while PTR != NULL.

3.  Apply PROCESS to INFO[PTR]

4.  Set PTR : = LINK[PTR].  [PTR now points to the next node.]

   [End of Step 2 Loop]

5. Exit.

If You want to learn about the technology, computer science & engineering, web programming, freelancing, earning please click here :CSE SOLVE

Related Posts:

  • Inserting at the Beginning of a List Algorithm:   INSFIRST(INFO,  LINK,  START, AVAIL, ITEM) This algorithm inserts ITEM as the first node in the list. 1.     [OVERFLOW?]  If AVAIL = NULL , then : Write: OVERFLOW… Read More
  • Deleting the Node Following a Given Node Algorithm: DEL(INFO,  LINK,  START,  AVAIL,  LOC,  LOCP) This algorithm deletes the node N with location LOC,  LOCP is the location of the node which precedes N or , where N is the first node… Read More
  • Inserting at the Beginning of a List Algorithm:   INSFIRST(INFO,  LINK,  START, AVAIL, ITEM) This algorithm inserts ITEM as the first node in the list. 1.     [OVERFLOW?]  If AVAIL = NULL , then : Write: OVERFLOW… Read More
  • Deleting the Node Following a Given Node Algorithm: DEL(INFO,  LINK,  START,  AVAIL,  LOC,  LOCP) This algorithm deletes the node N with location LOC,  LOCP is the location of the node which precedes N or , where N is the first node… Read More
  • Inserting after a Given Node Algorithm:  INSLOC(INFO, LINK, START, AVAIL, LOC, ITEM) This algorithm inserts ITEM so that ITEM follows the node with location LOC or inserts ITEM as the first node when LOC = NULL. 1.        … Read More

0 comments:

Post a Comment