14 |
|
* limitations under the License. |
15 |
|
*/ |
16 |
|
|
17 |
< |
import java.util.*; |
17 |
> |
package java.util; |
18 |
|
|
19 |
|
/** |
20 |
|
* A stable, adaptive, iterative mergesort that requires far fewer than |
46 |
|
* (privately) instantiable; a TimSort instance holds the state of an ongoing |
47 |
|
* sort, assuming the input array is large enough to warrant the full-blown |
48 |
|
* TimSort. Small arrays are sorted in place, using a binary insertion sort. |
49 |
+ |
* |
50 |
+ |
* @author Josh Bloch |
51 |
|
*/ |
52 |
|
class TimSort<T> { |
53 |
|
/** |
177 |
|
|
178 |
|
// If array is small, do a "mini-TimSort" with no merges |
179 |
|
if (nRemaining < MIN_MERGE) { |
180 |
< |
int initRunLen = countRunAndMakeAscending(a, lo, nRemaining, c); |
180 |
> |
int initRunLen = countRunAndMakeAscending(a, lo, hi, c); |
181 |
|
binarySort(a, lo, hi, lo + initRunLen, c); |
182 |
|
return; |
183 |
|
} |