$ cd
$ cd cs21/class
$ pwd
/home/your_user_name/cs21/class
$ mkdir week14
$ cd week14
$ pwd
/home/your_user_name/cs21/class/week14
$ cp ~newhall/public/cs21/week14/* .
We will continue with the linked list classes from last week (in linkedlist.py)
You can copy over code I wrote in class last week from:
$ cp ~newhall/public/cs21/week12/tias* .
insertSorted(elm):
(0) create a new node with elm as it data field
(1) if the list is empty, add this as the new head and tail node
(2) else if value <= head node value:
insert new node at head of list
(3) else if value >= tail node value:
insert new node at tail of list
(4) else insert new node somewhere between two nodes in the list
(a) Find the insertion spot
we need to traverse with curr and prev pointers
(b) insert new node between into the linked list between prev and curr