Building A sorted List
- We have decided that it is a good thing to have a sorted list if
we want to search it regularly.
- Occasional searches - linear search O(n)
- Unorderd list - fast insert O(1), slower delete O(n)
- Search Often - Binary Search O(lg n)
- Unorderd list - fast insert O(1), slower delete O(n), sort O(n2)
- Or could we build a sorted list?
- How expensive would it be to build and maintain an ordered list?
- Insert routine.
- Delete routine.
- A IsPresent routine.
- Add these.
- My Implementation
- Write a program to compare O(lg (n)), O(n), O(n2)