Chapter
Sorting
From ComputerScienceOne by Dr Chris Bourke
Concepts
- How does binary search work with arrays and lists?
"public static <T> int binarySearch(T[] a, T key, Comparator<T> c) takes an array of elements as well as a key and a Comparator, all of the same type T. It returns an integer representing the index at
- How do the Arrays and Collections classes sort elements?
"As with searching, the Arrays and Collections classes provide parameterized sorting methods to sort arrays and Lists. In Java 6 and prior, the implementation was a hybrid merge/insertion sort. Java 7
- How do sorted collections maintain element order?
"The Java Collections framework also provides several sorted data structures. Though an ordered collection such as a List can be sorted by calling the Collections.sort() method, a sorted data structur