Solve the Optimize method flip in SortUtils #1246
This commit is contained in:
parent
d678faeab6
commit
f3f2661d35
@ -38,7 +38,7 @@ final class SortUtils {
|
|||||||
* @param right is a right flip border of the array
|
* @param right is a right flip border of the array
|
||||||
*/
|
*/
|
||||||
static <T extends Comparable<T>> void flip(T[] array, int left, int right) {
|
static <T extends Comparable<T>> void flip(T[] array, int left, int right) {
|
||||||
while (left <= right) {
|
while (left < right) {
|
||||||
swap(array, left++, right--);
|
swap(array, left++, right--);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user