Page 128 - DCAP201_FUNDAMENTALS_OF_DATA_STRUCTURES
P. 128

Unit 8: Operations on Linked List




               Dispose the tail                                                                 Notes
                                    Figure 8.23: Disposing the Tail










          Source: http://www.csie.ntu.edu.tw/~hsinmu/courses/lib/exe/fetch.php?media=dsa_12spring:
          dsame_chap3.pdf




              Task  Why is deleting the Last Node in Doubly Linked List is a bit trickier than removing
            the first node? Discuss.

          Deleting an Intermediate Node in Doubly Linked List

          In this case, node to be removed is always located between two nodes. Head and tail links are
          not updated in this case. Such a removal can be done in two steps.


                 Example: The example given below shows the steps for deleting an Intermediate Node
          in Doubly Linked List.

               As similar to previous case, maintain previous node also while traversing the list. Once
               we found the node to be deleted, change the previous nodes next pointer to the next node
               of the node to be deleted.

                                 Figure 8.24: Change the Previous Nodes












          Source: http://www.csie.ntu.edu.tw/~hsinmu/courses/lib/exe/fetch.php?media=dsa_12spring:
          dsame_chap3.pdf
               Dispose the current node to be deleted.

                                 Figure 8.25: Dispose the Current Node










          Source: http://www.csie.ntu.edu.tw/~hsinmu/courses/lib/exe/fetch.php?media=dsa_12spring:
          dsame_chap3.pdf




                                           LOVELY PROFESSIONAL UNIVERSITY                                   121
   123   124   125   126   127   128   129   130   131   132   133