COSC 2320 Chapter 17-18: Chapter 17-18

41 views2 pages

Document Summary

From presentation slides (list single: alist add(newentry) method. Assign new value at the end of list. Increment length of list: alist add(newpoistion, newentry) method. Assign new value at position of list. Shift existing entries to avoid gap in the array. Invalid call should return null value: llist. Class node firstnode references to the first node remember the address of the first node. Adding to the end of the empty linked based list firstnode = newnode; Adding to the end of the non-empty linked based list lastnode. next = newnode; Adding at the beginning of the linked based list. Adding at a given position within the linked based list. Removing from beginning of the list firstnode = firstnode. next; this removes first node. Nodebefore. next = nodeafter; this removes the middle node. If list has only 1 node firstnode = lastnode = null; If list has more than 1 node lastnode = nodebefore; Insertafter inserts the new node after a provided existing list node.

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