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);