Skip to content

Commit

Permalink
fix(JS, TS): chapter_sorting QuickSortMedian and QuickSortTailCall ex…
Browse files Browse the repository at this point in the history
…ample (#785)
  • Loading branch information
reeswell authored Sep 24, 2023
1 parent 29c5ff4 commit a6a1036
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions codes/javascript/chapter_sorting/quick_sort.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,12 @@ console.log('快速排序完成后 nums =', nums);

/* 快速排序(中位基准数优化) */
const nums1 = [2, 4, 1, 0, 3, 5];
const quickSortMedian = new QuickSort();
const quickSortMedian = new QuickSortMedian();
quickSortMedian.quickSort(nums1, 0, nums1.length - 1);
console.log('快速排序(中位基准数优化)完成后 nums =', nums1);

/* 快速排序(尾递归优化) */
const nums2 = [2, 4, 1, 0, 3, 5];
const quickSortTailCall = new QuickSort();
const quickSortTailCall = new QuickSortTailCall();
quickSortTailCall.quickSort(nums2, 0, nums2.length - 1);
console.log('快速排序(尾递归优化)完成后 nums =', nums2);
4 changes: 2 additions & 2 deletions codes/typescript/chapter_sorting/quick_sort.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,13 +170,13 @@ console.log('快速排序完成后 nums =', nums);

/* 快速排序(中位基准数优化) */
const nums1 = [2, 4, 1, 0, 3, 5];
const quickSortMedian = new QuickSort();
const quickSortMedian = new QuickSortMedian();
quickSortMedian.quickSort(nums1, 0, nums1.length - 1);
console.log('快速排序(中位基准数优化)完成后 nums =', nums1);

/* 快速排序(尾递归优化) */
const nums2 = [2, 4, 1, 0, 3, 5];
const quickSortTailCall = new QuickSort();
const quickSortTailCall = new QuickSortTailCall();
quickSortTailCall.quickSort(nums2, 0, nums2.length - 1);
console.log('快速排序(尾递归优化)完成后 nums =', nums2);

Expand Down

0 comments on commit a6a1036

Please sign in to comment.