Unverified Commit bb7aa155 authored by XTh3G4p's avatar XTh3G4p Committed by GitHub
Browse files

修复数组越界的错误

parent a66c1de8
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@ void bubble_sort(int *a, int n) {
  bool flag = true;
  while (flag) {
    flag = false;
    for (int i = 1; i < n; ++i) {
    for (int i = 0; i < n - 1; ++i) {
      if (a[i] > a[i + 1]) {
        flag = true;
        int t = a[i];