From a6a1036dc968929ee0130f8e28c171066519c86c Mon Sep 17 00:00:00 2001 From: Reese Wellin Date: Sun, 24 Sep 2023 01:14:28 -0700 Subject: [PATCH] fix(JS, TS): chapter_sorting QuickSortMedian and QuickSortTailCall example (#785) --- codes/javascript/chapter_sorting/quick_sort.js | 4 ++-- codes/typescript/chapter_sorting/quick_sort.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/codes/javascript/chapter_sorting/quick_sort.js b/codes/javascript/chapter_sorting/quick_sort.js index 7cb9816bf..717f487b8 100644 --- a/codes/javascript/chapter_sorting/quick_sort.js +++ b/codes/javascript/chapter_sorting/quick_sort.js @@ -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); diff --git a/codes/typescript/chapter_sorting/quick_sort.ts b/codes/typescript/chapter_sorting/quick_sort.ts index f36611c92..d19d5f766 100644 --- a/codes/typescript/chapter_sorting/quick_sort.ts +++ b/codes/typescript/chapter_sorting/quick_sort.ts @@ -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);