diff --git a/book/content/part04/bubble-sort.asc b/book/content/part04/bubble-sort.asc index ed146f7d..583d8415 100644 --- a/book/content/part04/bubble-sort.asc +++ b/book/content/part04/bubble-sort.asc @@ -3,6 +3,7 @@ ifndef::imagesdir[] :codedir: ../../../src endif::[] +[[bubble-sort]] ==== Bubble Sort (((Bubble Sort))) (((Sorting, Bubble Sort))) diff --git a/book/content/part04/quick-sort.asc b/book/content/part04/quick-sort.asc index ad2dfdbb..314caad8 100644 --- a/book/content/part04/quick-sort.asc +++ b/book/content/part04/quick-sort.asc @@ -83,11 +83,11 @@ With the optimization, Quicksort has an _O(n log n)_ running time. Similar to th - <>: [big]#️❌# No, the pivot element can be choose at random. - Recursive: Yes - Time Complexity: [big]#✅# <> _O(n log n)_ -- Space Complexity: [big]#✅# <> _O(1)_ +- Space Complexity: [big]#✅# <> _O(log n)_, because of recursion. (((Linearithmic))) (((Runtime, Linearithmic))) -(((Space complexity, Constant))) +(((Space complexity, Logarithmic))) // Resources: // https://www.khanacademy.org/computing/computer-science/algorithms/quick-sort/a/linear-time-partitioning diff --git a/book/content/part04/sorting-algorithms.asc b/book/content/part04/sorting-algorithms.asc index 31d2f4f0..67ea34a4 100644 --- a/book/content/part04/sorting-algorithms.asc +++ b/book/content/part04/sorting-algorithms.asc @@ -9,7 +9,7 @@ Sorting is one of the most common solutions when we want to extract some insight We can sort to get the maximum or minimum value and many algorithmic problems involves sorting data first. .We are going to explore three basic sorting algorithms _O(n^2^)_ which have low overhead: -- <> +- <> - <> - <> @@ -120,7 +120,7 @@ We explored many algorithms some of them simple and other more performant. Also, [cols="20,80"] |=== | Algorithms | Comments -| <> | Swap pairs bubbling up largest numbers to the right +| <> | Swap pairs bubbling up largest numbers to the right | <> | Look for biggest number to the left and swap it with current | <> | Iterate array looking for smallest value to the right | <> | Split numbers in pairs, sort pairs and join them in ascending order @@ -131,11 +131,11 @@ We explored many algorithms some of them simple and other more performant. Also, .Sorting algorithms time/space complexity and properties |=== | Algorithms | Avg | Best | Worst | Space | Stable | In-place | Online | Adaptive -| <> | O(n^2^) | O(n) | O(n^2^) | O(1) | Yes | Yes | Yes | Yes +| <> | O(n^2^) | O(n) | O(n^2^) | O(1) | Yes | Yes | Yes | Yes | <> | O(n^2^) | O(n) | O(n^2^) | O(1) | Yes | Yes | Yes | Yes | <> | O(n^2^) | O(n^2^) | O(n^2^) | O(1) | No | Yes | No | No | <> | O(n log n) | O(n log n) | O(n log n) | O(n) | Yes | No | No | No -| <> | O(n log n) | O(n log n) | O(n^2^) | O(log n) | No | Yes | No | No +| <> | O(n log n) | O(n log n) | O(n^2^) | O(log n) | No | Yes | No | No // | Tim sort | O(n log n) | O(log n) | Yes | No | No | Yes |=== // end::table[]

AltStyle によって変換されたページ (->オリジナル) /