Merge pull request #684 from kevinxuv/develop

Fix isSorted
This commit is contained in:
CyC2018 2019-04-24 14:03:08 +08:00 committed by GitHub
commit fc0b421f06
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -95,7 +95,7 @@ public class Bubble<T extends Comparable<T>> extends Sort<T> {
int N = nums.length;
boolean isSorted = false;
for (int i = N - 1; i > 0 && !isSorted; i--) {
hasSorted = true;
isSorted = true;
for (int j = 0; j < i; j++) {
if (less(nums[j + 1], nums[j])) {
isSorted = false;