Skip to content

Commit

Permalink
fix name error: adjust
Browse files Browse the repository at this point in the history
  • Loading branch information
FaithALL committed Aug 24, 2021
1 parent 8b36055 commit 8fe78d9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions algorithm/sort.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using namespace std;

//堆排序:堆调整
void adujust_heap(int arr[], int start, int end) {
void adjust_heap(int arr[], int start, int end) {
int dad = start;
int son = 2 * dad + 1;

Expand All @@ -23,11 +23,11 @@ void adujust_heap(int arr[], int start, int end) {
//堆排序
void heap_sort(int arr[], int len) {
for (int i = len / 2 - 1; i >= 0; --i) {
adujust_heap(arr, i, len - 1);
adjust_heap(arr, i, len - 1);
}
for (int i = len - 1; i > 0; --i) {
swap(arr[0], arr[i]);
adujust_heap(arr, 0, i - 1);
adjust_heap(arr, 0, i - 1);
}
}

Expand Down

0 comments on commit 8fe78d9

Please sign in to comment.