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 db81811 commit 4d9e89c
Show file tree
Hide file tree
Showing 297 changed files with 755 additions and 1,560 deletions.
28 changes: 0 additions & 28 deletions docs/algorithm/advanced/final_exam_prep.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ int main() {
```
### BIT
##### apple tree
Expand Down Expand Up @@ -275,7 +274,6 @@ int main() {
```



### Segment Tree

##### Balanced Lineup
Expand Down Expand Up @@ -352,7 +350,6 @@ int main() {
```
##### integers
```c++
Expand Down Expand Up @@ -458,7 +455,6 @@ int main() {
```



##### kth-Number

```c++
Expand Down Expand Up @@ -544,7 +540,6 @@ int main() {
```
##### Mayor's Poster
```c++
Expand Down Expand Up @@ -640,9 +635,6 @@ int main() {
```





### Trie

##### Proto
Expand Down Expand Up @@ -736,7 +728,6 @@ int main() {
```
### Directed Tarjan
##### popular cows
Expand Down Expand Up @@ -840,7 +831,6 @@ int main() {
```



### Shortest Path

###### candies
Expand Down Expand Up @@ -929,7 +919,6 @@ int main() {
```
##### currency exchange
```c++
Expand Down Expand Up @@ -1000,7 +989,6 @@ int main() {
```



##### Warmholes

```c++
Expand Down Expand Up @@ -1075,7 +1063,6 @@ int main() {
```
##### cow contest
```c++
Expand Down Expand Up @@ -1153,17 +1140,13 @@ int main() {
```





----

### Undirected Tarjan

···



### Maximum Flow

##### Alice's Chance
Expand Down Expand Up @@ -1425,9 +1408,6 @@ int main() {
```





### Geometry

##### TOYS
Expand Down Expand Up @@ -1987,11 +1967,6 @@ int main() {
```







### Suffix Array

##### Substrings
Expand Down Expand Up @@ -2112,6 +2087,3 @@ int main() {
```
26 changes: 9 additions & 17 deletions docs/algorithm/advanced/后缀数组.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ sa[5] = 2 nana
```



### $O(n \log n)$ Method to find SA

* **j-suffix**
Expand Down Expand Up @@ -68,7 +67,6 @@ sa[5] = 2 nana
```
### RMQ (Sparse Table)
Range Maximum/Minimum Query. `RMQ(arr, i, j)`
Expand Down Expand Up @@ -165,9 +163,6 @@ int main() {
```
### 最长公共前缀数组
任给两个后缀,O(1)求其最长公共前缀(LCP)的长度。
Expand Down Expand Up @@ -196,20 +191,26 @@ LCPL(i, j) = min{height[i+1, ..., j]} // RMQ O(1)
* LCP引理1
$$
\displaylines{
LCPL(i, j) = min\{LCPL(k, k+1)| k=i, ..., j-1\}
}
$$
* LCP引理2
$$
\displaylines{
\forall i \le k \lt j \\
LCPL(k, j) \ge LCPL(i, j)
}
$$
Expand All @@ -221,19 +222,16 @@ $$
`i>0 && Rank[i]>0`时:
$$
\displaylines{
H[i] \ge H[i-1] -1
}
$$
```c++
int Rank[maxn], height[maxn];
void buildHeight(char* str, int n, int* sa){
Expand All @@ -252,11 +250,9 @@ buildHeight("abcd", 5, sa);
```



### Applications



###### POJ2774 Long Long Message

求两个字符串的最长公共子串。
Expand Down Expand Up @@ -345,7 +341,6 @@ int main() {
```
###### 最长公共子串(多序列)
[ref](https://www.xuebuyuan.com/3226411.html)
Expand All @@ -357,7 +352,6 @@ int main() {
* 最坏复杂度$O(l L\log L)$,在所有字符串都只含有同一个字符时达到。
###### POJ3450 Corporate Identity
```c++
Expand Down Expand Up @@ -487,7 +481,6 @@ int main() {
```



###### Musical Theme POJ

不重叠的最长重复子串。
Expand Down Expand Up @@ -589,7 +582,6 @@ int main() {
```
##### Milk Pattern
可重叠的至少k次的最长重复子序列。
Expand Down
2 changes: 0 additions & 2 deletions docs/algorithm/advanced/图的连通性.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@
```



### 无向连通图

* 割点&桥
Expand Down Expand Up @@ -759,4 +758,3 @@
```
1 change: 0 additions & 1 deletion docs/algorithm/advanced/并查集.md
Original file line number Diff line number Diff line change
Expand Up @@ -366,4 +366,3 @@
```



7 changes: 4 additions & 3 deletions docs/algorithm/advanced/最短路算法.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,15 @@

时间复杂度分析:


$$
\displaylines{
T(n) = O(E)*dk_Q + O(V)*em_Q
}
$$


$dk_Q$ means **Decrease Key**, we need to sort all edges once in the whole algo.

$em_Q$ means Extract Min, for each vertex, we calculate the next shortest edge once.
Expand Down Expand Up @@ -170,9 +174,6 @@ int main() {
```
### Examples
* Currency Exchange
Expand Down
4 changes: 3 additions & 1 deletion docs/algorithm/advanced/树状数组.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,11 @@
$O(N)$: build time complexity
$$
\displaylines{
C[k] = sum(k)-sum(k-lowbit(k))
}
$$
Expand Down Expand Up @@ -215,7 +218,6 @@ int query(int i, int j) {
```
* Examples
* 最长上升子序列
Expand Down
4 changes: 4 additions & 0 deletions docs/algorithm/advanced/线段树.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,16 @@ struct node{

Not a complete tree, but nearly.


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


so it is safe if we assign `[4 * maxn]` nodes, then we can use $2*i+1, 2*i+2$ instead of `node*`

### Operations
Expand Down
4 changes: 0 additions & 4 deletions docs/algorithm/advanced/线段树2.md
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,6 @@
保证边重合的情况,两边不都算。
```c++
#include <iostream>
#include <algorithm>
Expand Down Expand Up @@ -419,9 +418,6 @@
```





#### 二维线段树

* Matrix
Expand Down
8 changes: 0 additions & 8 deletions docs/algorithm/advanced/线段树总结.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,6 @@ int main() {
```
### 动态线段树:区间最值替换
**替换**某个区间的最值为某个数。而非增加到某个数(见下)。也不是取当前值与目标值的最大值(无法实现)。
Expand Down Expand Up @@ -153,7 +150,6 @@ void modify(int rt, int l, int r, int v) {
```



###### LeetCode 699 Falling Squares

```c++
Expand Down Expand Up @@ -251,9 +247,6 @@ public:
```
### 动态线段树:区间加减
支持区间求和、求最值。
Expand Down Expand Up @@ -363,4 +356,3 @@ int main() {
```



Loading

0 comments on commit 4d9e89c

Please sign in to comment.