Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
ashawkey committed Dec 29, 2023
1 parent 4d9e89c commit d695e23
Show file tree
Hide file tree
Showing 87 changed files with 95 additions and 342 deletions.
6 changes: 0 additions & 6 deletions docs/algorithm/advanced/后缀数组.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,7 @@ LCPL(i, j) = min{height[i+1, ..., j]} // RMQ O(1)
$$
\displaylines{
LCPL(i, j) = min\{LCPL(k, k+1)| k=i, ..., j-1\}
}
$$
Expand All @@ -206,10 +204,8 @@ $$
$$
\displaylines{
\forall i \le k \lt j \\
LCPL(k, j) \ge LCPL(i, j)
}
$$
Expand All @@ -225,9 +221,7 @@ $$
$$
\displaylines{
H[i] \ge H[i-1] -1
}
$$
Expand Down
1 change: 0 additions & 1 deletion docs/algorithm/advanced/最短路算法.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
$$
\displaylines{
T(n) = O(E)*dk_Q + O(V)*em_Q
}
$$

Expand Down
2 changes: 0 additions & 2 deletions docs/algorithm/advanced/线段树.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ struct node{

$$
\displaylines{
2*2^{ceil(log_2(n))}-1 \le 4n-1
}
$$

Expand Down
6 changes: 0 additions & 6 deletions docs/algorithm/basic/DA01_Intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,9 @@

$$
\displaylines{
\exist C,N_0 \gt 0 \ \ s.t. \ \forall n \ge N_0:\\
f(n) \le C \cdot g(n) \\
\Rightarrow f(n) \in O(g(n))
}
$$

Expand All @@ -93,11 +91,9 @@ $$

$$
\displaylines{
\exist C,N_0 \gt 0 \ \ s.t. \ \forall n \ge N_0:\\
f(n) \ge C \cdot g(n) \\
\Rightarrow f(n) \in \Omega(g(n))
}
$$

Expand All @@ -109,10 +105,8 @@ $$

$$
\displaylines{
f(n) \in O(g(n)) \ and \ f(n) \in \Omega(g(n)) \\
\Rightarrow f(n) \in \Theta(g(n))
}
$$

Expand Down
4 changes: 0 additions & 4 deletions docs/algorithm/basic/DA02_LinearTable.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,9 @@ Link the head and tail.
$$
\displaylines{
2t - t = km \\
2t'-t' = (k+1)m \\
\therefore t'-t = m
}
$$
Expand All @@ -111,12 +109,10 @@ $$
$$
\displaylines{
t = n + x \\
t = km \\
\therefore km = n +x \\
(k-1)m + (m-x) = n \\
}
$$
Expand Down
1 change: 0 additions & 1 deletion docs/algorithm/basic/DA03_StackAndQueue.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
* **性质**



$$
\displaylines{
C_0 = 1 \ \ and \ \ C_{n+1} = \sum_{i=0}^nC_iC_{n-i} \\
Expand Down
7 changes: 0 additions & 7 deletions docs/algorithm/basic/DA05_BinaryTree.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ $$
... \\
f(n) = f(n-1)f(0) + f(n-2)f(1) + ... + f(1)f(n-2) + f(n-1)f(0) \\
the\ solution\ is \ f(n) = \frac{C_{2n}^n}{n+1}
}
$$

Expand Down Expand Up @@ -93,7 +92,6 @@ $$
I_{n+1} = I_n + k \\
E_{n+1} = E_n -k+2(k+1) = E_n+k+2 \\
E_{n+1} = I_{n+1}+2(n+1)
}
$$
Expand All @@ -110,7 +108,6 @@ $$
$$
\displaylines{
P=NK - (N-1) = N(K-1)+1
}
$$
Expand All @@ -123,7 +120,6 @@ $$
N = N_0 + N_1 + N_2 = E +1\\
E = N_1 + 2N_2 \\
\Rightarrow N_0 = N_2 + 1
}
$$
Expand Down Expand Up @@ -515,7 +511,6 @@ $$
\frac {D(N)} {N+1} = \frac {D(N-1)}{N} + \frac{2(N-1)}{N(N+1)} \\
f(n) = f(n-1)+O(1/n) \\
f(n) \in \sum_{i=1}^nO(1/n) = O(log\ n)
}
$$

Expand All @@ -530,7 +525,6 @@ $$
\sum_{i=1}^{N}\frac 1 i \in O(logN) \\
this \ follows \ continuous \ condition: \\
\int \frac 1 xdx = lnx
}
$$

Expand Down Expand Up @@ -627,7 +621,6 @@ $$
$$
\displaylines{
\sum_{i=0}^{logn}2^i(logn - i) = \sum_{j=0}^{logn}n\frac j {2^j} \lt 2n
}
$$
Expand Down
10 changes: 0 additions & 10 deletions docs/algorithm/basic/DA10_Search.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ $$

$$
\displaylines{
\sum_{i=1}^n\frac 1 n(n-i+1) = \frac {n+1} 2
}
$$

Expand Down Expand Up @@ -133,9 +131,7 @@ $$

$$
\displaylines{
x_{(a)} \rightarrow x_{(b)} = y_{(a)}
}
$$

Expand Down Expand Up @@ -219,10 +215,8 @@ $$

$$
\displaylines{
ASL_{succ} = \frac 1 {11} (1+5+1+2+2+1+1+1+1+2+3) = 20/11 \\
ASL_{fail} = \frac 1 {13} (8+7+6+5+4+3+2+1+1+1+2+1+11) = 4
}
$$

Expand All @@ -236,10 +230,8 @@ $$

$$
\displaylines{
p(K, 2i-1) = i^2 \\
p(K, 2i) = -i^2
}
$$

Expand All @@ -251,9 +243,7 @@ $$

$$
\displaylines{
p(K, i) = perm[i-1]
}
$$

Expand Down
2 changes: 0 additions & 2 deletions docs/algorithm/basic/DA11_Index.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,6 @@
$$
\displaylines{
m = l + m' = l + n - 1 = \sum_{i=1}^n(x_i + 1) = N + n
}
$$
Expand Down Expand Up @@ -346,7 +345,6 @@ $$
h \le 2k+1 \\
n \ge 2^k - 1 \\
\Rightarrow h\le 2log_2(n+1)+1
}
$$
Expand Down
4 changes: 0 additions & 4 deletions docs/algorithm/basic/DA12_Advanced.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@

$$
\displaylines{
loc(A[j_0, ..., j_{n-1}]) = loc(A[0,...,0])\\
+ size*[\sum_{i=0}^{n-2}(j_i\prod_{k=i+1}^{n-1}d_k)+j_{n-1}]
}
$$

Expand Down Expand Up @@ -105,12 +103,10 @@ TAIL: 广义表中**第一个元素以外的元素构成的(!)广义表(!)**。

$$
\displaylines{

\frac {p_i} W = \frac {q_j} W = \frac 1 {2n+1} \\
ASL(n) = \frac 1 {2n+1} (\sum_{i=1}^n(H(p_i)+1)+\sum_{j=0}^nH(q_j)) \\
= \frac 1 {2n+1} (I+n+E)\\
= \frac {2I+3n} {2n+1}

}
$$

Expand Down
1 change: 0 additions & 1 deletion docs/algorithm/review/Python.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ l = [x in l if x != val]
Not well supported. Use list comprehension or filter.



### set

```python
Expand Down
1 change: 0 additions & 1 deletion docs/algorithm/review/old/字符串.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@
```



### 最长公共子串

求N个字符串的最长公共子串(每个字符串最长为L)
Expand Down
1 change: 0 additions & 1 deletion docs/algorithm/review/problem_series/search_2d_matrix.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
在一个 n * m 的二维数组中,每一行都按照从左到右递增的顺序排序,每一列都按照从上到下递增的顺序排序。请完成一个高效的函数,输入这样的一个二维数组和一个整数,判断数组中是否含有该整数。



并不是二维二分!没有二维二分法!

```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,7 @@ properties:

$$
\displaylines{

hash(s[i:j+1]) = hash(s[:j]) - hash(s[:i-1])\cdot P^{j-i+1}

}
$$

Expand Down
10 changes: 0 additions & 10 deletions docs/algorithm/review/区间问题.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ Q[i, j] = sums[j] - sums[i-1]
```



#### 差分

支持$O(1)$的区间修改,以及均摊$O(1)$的单点查询(需要查询所有单点的值)。
Expand Down Expand Up @@ -114,7 +113,6 @@ arr[i] = diff[i] + arr[i-1]
```
* [1D discretized array](https://leetcode.cn/problems/my-calendar-iii/)
区间范围远大于区间数量时,需要使用map模拟稀疏数组。
Expand All @@ -140,8 +138,6 @@ arr[i] = diff[i] + arr[i-1]
```




* 2D array

通常用`s[i][j]`表示**右下子矩阵`x[i:][j:]`**的增量,这样可以正向循环求原始矩阵值。
Expand All @@ -168,8 +164,6 @@ arr[i] = diff[i] + arr[i-1]
```
#### 树状数组
支持$O(\log n)$时间的单点更新与区间求和。
Expand Down Expand Up @@ -219,8 +213,6 @@ arr[i] = diff[i] + arr[i-1]
```




#### 线段树

支持$O(\log n)$时间的区间更新与区间求和,但常数较大。
Expand Down Expand Up @@ -439,15 +431,13 @@ int query(int i, int j) {
```



* [增量](https://leetcode.cn/problems/my-calendar-iii/)

```cpp

```



* 动态

```cpp
Expand Down
2 changes: 0 additions & 2 deletions docs/algorithm/review/双指针.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
若要找到环头,则相遇之后再从起点跑一个指针,此指针与slow指针相遇时即到达环头。




### 有序数组中的搜索

##### 两数之和
Expand Down
3 changes: 0 additions & 3 deletions docs/algorithm/review/基础.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
```
* fast power
```c++
Expand Down Expand Up @@ -96,7 +95,6 @@
```



* Fibonacci

```c++
Expand Down Expand Up @@ -265,7 +263,6 @@
```
* GCD/LCM
```c++
Expand Down
Loading

0 comments on commit d695e23

Please sign in to comment.