Solve the Optimize method flip in SortUtils #1246

This commit is contained in:
MK 2020-03-17 14:35:13 +08:00
parent d678faeab6
commit f3f2661d35

View File

@ -38,7 +38,7 @@ final class SortUtils {
* @param right is a right flip border of the array
*/
static <T extends Comparable<T>> void flip(T[] array, int left, int right) {
while (left <= right) {
while (left < right) {
swap(array, left++, right--);
}
}