Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(JS, TS): chapter_sorting QuickSortMedian and QuickSortTailCall exa… #785

Merged
merged 1 commit into from
Sep 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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