CS230 Lecture Notes - Lecture 13: Linked List, While Loop

68 views2 pages

Document Summary

Structure in which there"s a head, each item has a value and a pointer to the next item. There is a head reference and a tail reference. To append a node to the end of the linked list, simply have the current tail reference the new item then have the new item be referenced as the tail node. If the list is empty then the head and tail will just reference the node that is about to be appended. To remove the last node, traverse through the linked list and make the 2nd last item reference none and have the tail reference that item. To remove any nodes in the middle, traverse through the linked list until you found the item that you want to remove, then make the item before it reference the item after it. To remove the first node, make the head reference the second item in the list and make the first item reference none.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents