Types of searches
- Linear search
- Best you can do with unsorted data
- Time ∝ n
- Binary search
- For sorted data
- Divide and conquer
- Time ∝ log n
Types of sorts
- Bad sorts
- Selection sort
- Insertion sort
- Time ∝ n2
- Good sorts
- Merge sort
- Quicksort
- Time ∝ n log(n)
One of the first computer generated animations was Sorting Out Sorting produced at the University of Toronto in 1981 after three years of work. A more recent animation is 15 Sorting Algorithms in 6 minutes.
big-O
- Don Knuth’s defining paper
- Common Big-Oh Growth Rates
- Big O notation on Wikipedia
- 16.070 lecture
- More next Fall in CSCI 333
Use in Java
- Natural ordering with
Comparable
Arrays.binarySearch
Arrays.sort