 | Chapter Summary (See related pages)
- Searching and sorting are two of the most basic nonnumeric applications of computer programs.
- Linear search looks for a value in a linear sequence.
- Binary search looks for a value by successively comparing the element in the middle of a sorted list.
- Selection sort is a basic sorting routine that runs in time proportion to N2, where N is the size of the list to sort.
- Bubble sort is another N2 performance algorithm, but it runs faster than the selection sort on average.
- Heapsort has a N log2N performance. It uses a special heap data structure to sort the elements.
- Using a class that implements the Comparator interface is convenient and flexible to dictate the manner in which objects of a class are compared.
- The Comparator interface has one method, called compare.
- The standard classes and interfaces described or used in this chapter are
Comparator Arrays
|
|