We will continue with the linked list classes from last week (in linkedlist.py)
You can copy over code I wrote in class on Tuesday, 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:
(a) Find the insertion spot
we need to traverse with curr and prev pointers
(b) Insert it into the linked list. 3 cases:
(1) insert before current head node
(2) insert after current tail node
(3) insert between two linked list nodes:
need to change the new node's next field to point to the node
after the insertion spot, and change the next field of the node
immediately before the insertion spot to point to the new node