From d1f307e54765fd7d74c50ee4b4a95cbcfd623bde Mon Sep 17 00:00:00 2001 From: krahets Date: Sat, 4 May 2024 19:56:43 +0800 Subject: [PATCH] Bug fixes --- codes/ruby/chapter_sorting/quick_sort.rb | 3 +-- en/docs/chapter_computational_complexity/space_complexity.md | 4 ++-- en/docs/chapter_computational_complexity/time_complexity.md | 4 ++-- zh-hant/codes/ruby/chapter_sorting/quick_sort.rb | 3 +-- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/codes/ruby/chapter_sorting/quick_sort.rb b/codes/ruby/chapter_sorting/quick_sort.rb index 2dff14c6b..0ef9c48ff 100644 --- a/codes/ruby/chapter_sorting/quick_sort.rb +++ b/codes/ruby/chapter_sorting/quick_sort.rb @@ -9,7 +9,6 @@ class QuickSort class << self ### 哨兵划分 ### def partition(nums, left, right) - # 以 nums[left] 为基准数 i, j = left, right while i < j @@ -116,7 +115,7 @@ class QuickSortTailCall i # 返回基准数的索引 end - ### 快速排序(尾递归优化) + ### 快速排序(尾递归优化)### def quick_sort(nums, left, right) # 子数组长度不为 1 时递归 while left < right diff --git a/en/docs/chapter_computational_complexity/space_complexity.md b/en/docs/chapter_computational_complexity/space_complexity.md index 96a60f835..a3ed5be69 100644 --- a/en/docs/chapter_computational_complexity/space_complexity.md +++ b/en/docs/chapter_computational_complexity/space_complexity.md @@ -729,8 +729,8 @@ Let the size of the input data be $n$, the following chart displays common types $$ \begin{aligned} -O(1) < O(\log n) < O(n) < O(n^2) < O(2^n) \newline -\text{Constant Order} < \text{Logarithmic Order} < \text{Linear Order} < \text{Quadratic Order} < \text{Exponential Order} +& O(1) < O(\log n) < O(n) < O(n^2) < O(2^n) \newline +& \text{Constant} < \text{Logarithmic} < \text{Linear} < \text{Quadratic} < \text{Exponential} \end{aligned} $$ diff --git a/en/docs/chapter_computational_complexity/time_complexity.md b/en/docs/chapter_computational_complexity/time_complexity.md index 585ca057d..b2f5e64d6 100644 --- a/en/docs/chapter_computational_complexity/time_complexity.md +++ b/en/docs/chapter_computational_complexity/time_complexity.md @@ -955,8 +955,8 @@ Let's consider the input data size as $n$. The common types of time complexities $$ \begin{aligned} -O(1) < O(\log n) < O(n) < O(n \log n) < O(n^2) < O(2^n) < O(n!) \newline -\text{Constant Order} < \text{Logarithmic Order} < \text{Linear Order} < \text{Linear-Logarithmic Order} < \text{Quadratic Order} < \text{Exponential Order} < \text{Factorial Order} +& O(1) < O(\log n) < O(n) < O(n \log n) < O(n^2) < O(2^n) < O(n!) \newline +& \text{Constant} < \text{Log} < \text{Linear} < \text{Linear-Log} < \text{Quadratic} < \text{Exp} < \text{Factorial} \end{aligned} $$ diff --git a/zh-hant/codes/ruby/chapter_sorting/quick_sort.rb b/zh-hant/codes/ruby/chapter_sorting/quick_sort.rb index aeb031dbe..221a17715 100644 --- a/zh-hant/codes/ruby/chapter_sorting/quick_sort.rb +++ b/zh-hant/codes/ruby/chapter_sorting/quick_sort.rb @@ -9,7 +9,6 @@ class QuickSort class << self ### 哨兵劃分 ### def partition(nums, left, right) - # 以 nums[left] 為基準數 i, j = left, right while i < j @@ -116,7 +115,7 @@ class QuickSortTailCall i # 返回基準數的索引 end - ### 快速排序(尾遞迴最佳化) + ### 快速排序(尾遞迴最佳化)### def quick_sort(nums, left, right) # 子陣列長度不為 1 時遞迴 while left < right