Write the following methods for the Linked List class:
-
append
- arguments: new value
- adds a new node with the given value to the end of the list
-
insert before
- arguments: value, new value
- adds a new node with the given new value immediately before the first node that has the value specified
-
insert after
- arguments: value, new value
- adds a new node with the given new value immediately after the first node that has the value specified
- Write out problem statement
- create append function
- create insert before function
- create insert after function
- used images as a guide and talked out algorithm
- The Big O time is O(N) because only iterating each value once and space is O(1) because it gives back a single new node
