Procedure PRINT (TEMPHEAD)
[This procedure print the element of the node in the LIFO and FIFO format and TEMPHEAD points the first element of the list]
1. [Check for the empty list]
If TEMPHEAD = NULL
Then write (“Empty list”)
Return
2. [First in first out]
Repeat while RPTR (TEMPHEAD)! = NULL
Write (INOF (TEMPHEAD))
3. [Last in first out]
Repeat while TEMPHEAD! = NULL
Write (INFO (TEMPHEAD))
4. [Finished]
Return
No comments:
Post a Comment