Skip to content

Commit

Permalink
fix bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
wangzheng committed Oct 15, 2018
1 parent 80550d6 commit 35f6a3a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions java/11_sorts/Sorts.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ public class Sorts {
public static void bubbleSort(int[] a, int n) {
if (n <= 1) return;

// 提前退出标志位
boolean flag = false;
for (int i = 0; i < n; ++i) {
// 提前退出标志位
boolean flag = false;
for (int j = 0; j < n - i - 1; ++j) {
if (a[j] > a[j+1]) { // 交换
int tmp = a[j];
Expand Down

0 comments on commit 35f6a3a

Please sign in to comment.