jjb at google.com
Tue Jul 7 19:02:52 UTC 2009
>> 1) Should we update the Arrays class description and appropriate sort
>> methods to now refer to timsort instead of saying: "The sorting
>> algorithm is a modified mergesort...". I know this is not strictly
>> necessary, but you must have considered it already, right?
> No. I totally missed it. Good catch!
I propose this prose:
* Implementation note: This implementation is a stable, adaptive,
* mergesort that requires far fewer than n lg(n) comparisons when the
* array is partially sorted, while offering the performance of a
* mergesort when the input array is randomly ordered. If the input
* nearly sorted, the implementation requires approximately n
* Temporary storage requirements vary from a small constant for nearly
* input arrays to n/2 object references for randomly ordered input
* <p>The implementation takes equal advantage of ascending and
* in its input array, and can take advantage of ascending and
* in different parts of the the same input array. It is well-suited to
* merging two or more sorted arrays: simply concatenate the arrays and
* the resulting array.
* <p>The implementation was adapted from Tim Peters's list sort for
* (<a href="
* TimSort</a>). It uses techiques from Peter McIlroy's "Optimistic
* and Information Theoretic Complexity",in Proceedings of the Fourth
* ACM-SIAM Symposium on Discrete Algorithms, pp 467-474, January 1993.
There are six methods that could use this prose, four in java.uti.Arrays,
and two in java.util.Collections. Alternatively, the prose could be
included in one place, and linked to repeatedly.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the core-libs-dev