+ hashing, add #s
This commit is contained in:
parent
09c38f5423
commit
0c2e19b53f
7
content/2_Silver/Silver_Psum.md
Normal file
7
content/2_Silver/Silver_Psum.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
# Silver - Prefix Sums
|
||||
|
||||
See Ch 11 of https://www.overleaf.com/project/5e73f65cde1d010001224d8a
|
||||
|
||||
- CPH 9.1
|
||||
- aka Cumulative Sum, Partial Sums
|
||||
- 2D
|
|
@ -13,8 +13,7 @@ Given an array of size $N$, the task is to update the element at a single positi
|
|||
Sample Problems:
|
||||
|
||||
* [CSES Range Sum Queries II](https://cses.fi/problemset/task/1648)
|
||||
* [CSES Range XOR Queries](https://cses.fi/problemset/task/1650)
|
||||
* essentially the same as above
|
||||
* can also do range XOR queries w/ update
|
||||
* [SPOJ Inversion Counting](https://www.spoj.com/problems/INVCNT/)
|
||||
|
||||
## Binary Indexed Tree
|
23
content/3_Gold/Gold_Strings.md
Normal file
23
content/3_Gold/Gold_Strings.md
Normal file
|
@ -0,0 +1,23 @@
|
|||
# Gold - Strings
|
||||
|
||||
Author: Benjamin Qi
|
||||
|
||||
## Hashing
|
||||
|
||||
Use to quickly test whether two substrings are equal.
|
||||
|
||||
- Tutorial
|
||||
- CPH 26.3
|
||||
- [cp-algorithms String Hashing](https://cp-algorithms.com/string/string-hashing.html)
|
||||
- [Anti-Hash Tests](https://codeforces.com/blog/entry/60442)
|
||||
- On CodeForces educational rounds in particular, make sure to use random bases.
|
||||
|
||||
My implementation can be found [here](https://github.com/bqi343/USACO/blob/master/Implementations/content/strings%20(14)/Light/HashRange%20(14.2).h). It uses two bases rather than just one to decrease the probability that two random strings hash to the same value. As mentioned in the articles above, there is no need to calculate modular inverses.
|
||||
|
||||
### USACO Gold Problems (ok def need more)
|
||||
|
||||
- [Cownomics](http://www.usaco.org/index.php?page=viewproblem2&cpid=741)
|
||||
- Use two pointers; for a fixed $l$, keep extending $r$ to the right until the positions $l\ldots r$ explain spotiness.
|
||||
- Hashing gives you a way to quickly check whether two substrings of different cow types are equal. So for a single $[l,r]$ pair you can check whether it works in $O(N\log N)$ time (and you only need to check $O(M)$ of these pairs in total).
|
||||
- [Lightsout](http://www.usaco.org/index.php?page=viewproblem2&cpid=599)
|
||||
- figure out whether this actually needs hashing? (haven't implemented)
|
|
@ -1,5 +1,7 @@
|
|||
# Platinum - Fracturing Search
|
||||
|
||||
Author: Benjamin Qi
|
||||
|
||||
## General Outline
|
||||
|
||||
### Problem
|
|
@ -1,5 +1,7 @@
|
|||
# Platinum - Slope Trick
|
||||
|
||||
Author: Benjamin Qi
|
||||
|
||||
## Tutorials
|
||||
|
||||
Links:
|
|
@ -1,9 +0,0 @@
|
|||
# Gold - Strings
|
||||
|
||||
## Trie
|
||||
|
||||
## Hashing
|
||||
|
||||
- CPH 26.1, 26.2, 26.3
|
||||
- Hashing (once)?
|
||||
-
|
Reference in a new issue