Implement a simple linked list using pointers and classes.
- Add, remove, get, and set should be O(1) if
i == 0
or ifi == size()-1
- Add, remove, get, and set should throw a string exception if
i >= size()
. Find should throw a string exception ifi > size()
- Do not leak memory (make sure remove and the destructor do the right thing)
size()
is O(1) time (keep track of the numItems when you add or remove, so you can just return the variable)
"Open Data Structures," Chapter 3, up through section 2 (DLList), http://opendatastructures.org/ods-cpp/3_Linked_Lists.html
1. Which of the above requirements work, and which do not? For each requirement, write a brief response.
- TODO
- TODO
- TODO
- TODO