From 28ef3a708332c4bef6654e110674d49ebe90b139 Mon Sep 17 00:00:00 2001 From: Dusty Date: Wed, 23 Feb 2022 15:40:59 +0800 Subject: [PATCH] fix katex and stuff --- docs/.vuepress/config.js | 1 + docs/guide/funcs/bs.md | 2 +- docs/guide/funcs/bubblesort.md | 6 +++--- docs/guide/more-adv/dp.md | 6 +++--- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/docs/.vuepress/config.js b/docs/.vuepress/config.js index 1060a0fa..f8bfbc12 100644 --- a/docs/.vuepress/config.js +++ b/docs/.vuepress/config.js @@ -28,6 +28,7 @@ module.exports = { 'msup', 'mrow', 'annotation', + 'mtext', 'semantics', 'math', ].includes(tag)); diff --git a/docs/guide/funcs/bs.md b/docs/guide/funcs/bs.md index 39608560..9e52dd52 100644 --- a/docs/guide/funcs/bs.md +++ b/docs/guide/funcs/bs.md @@ -6,7 +6,7 @@ Binary Search is a searching algorithm used in a sorted array by repeatedly dividing the search interval in half. The idea of binary search is to use the information that the array is sorted and -reduce the time complexity to 𝒪(log n). +reduce the time complexity to $\mathcal{O}(\log{n})$. The basic steps to perform Binary Search are: diff --git a/docs/guide/funcs/bubblesort.md b/docs/guide/funcs/bubblesort.md index 2065c579..6fa16a9f 100644 --- a/docs/guide/funcs/bubblesort.md +++ b/docs/guide/funcs/bubblesort.md @@ -8,9 +8,9 @@ It is one of the simplest sorting algorithms. | Cases | Time | | -------------------------- | ----------------------------------------------------------------------------- | -| Worst-Case Time Complexity | $O(n^2)$. Worst case occurs when array is reverse sorted. | -| Best-Case Time Complexity | $O(n^2)$. Best case occurs when array is already sorted. | -| Auxiliary Space | $O(1)$ | +| Worst-Case Time Complexity | $\mathcal{O}(n^2)$. Worst case occurs when array is reverse sorted. | +| Best-Case Time Complexity | $\mathcal{O}(n^2)$. Best case occurs when array is already sorted. | +| Auxiliary Space | $\mathcal{O}(1)$ | | Boundary Cases | Bubble sort takes minimum time (order of n) when elements are already sorted. | | Property | :white_check_mark:/:x: | diff --git a/docs/guide/more-adv/dp.md b/docs/guide/more-adv/dp.md index 37b41db7..1e1588c7 100644 --- a/docs/guide/more-adv/dp.md +++ b/docs/guide/more-adv/dp.md @@ -21,7 +21,7 @@ long long sum(long long n) { ``` While this method works, it is far too slow and may check multiple numbers multiple times. -At `n = 5`, `sum(2)` is recalculated 3 times. +At $n = 5$, $\text{sum}(n)$ is recalculated 3 times. ### Top-down DP @@ -40,7 +40,7 @@ long long sum(long long n) { } ``` -The states are stored in `memo[]`, and the transition is `memo[n] = sum[n - 1] + sum[n - 2]`. The base cases are when `n <= 1`, `memo[n] = n`. +The states are stored in $\text{memo}[]$, and the transition is $\text{memo}[n] = \text{sum}[n - 1] + \text{sum}[n - 2]$. The base cases are when $n \leq 1$, $\text{memo}[n] = n$. While this form of DP may be more intuitive sometimes, it usually takes up more memory. @@ -58,7 +58,7 @@ for (long long i = 2; i < n; i++) { } ``` -The states are stored in `memo[n]`, the base cases are `memo[0]` and `memo[1]`, and the transition is `memo[i] = memo[i - 1] + memo[i - 2]`. +The states are stored in $\text{memo}[n]$, the base cases are $\text{memo}[0]$ and $\text{memo}[1]$, and the transition is $\text{memo}[i] = \text{memo}[i - 1] + \text{memo}[i - 2]$. ### Conclusion