Recently I read about LiChao Tree for convex hull trick, however I couldn't find any resource on internet showing on how to perform delete operations on LiChao trees. Is it even possible to do delete operations on such segment tree?
# | User | Rating |
---|---|---|
1 | tourist | 3985 |
2 | jiangly | 3814 |
3 | jqdai0815 | 3682 |
4 | Benq | 3529 |
5 | orzdevinwang | 3526 |
6 | ksun48 | 3517 |
7 | Radewoosh | 3410 |
8 | hos.lyric | 3399 |
9 | ecnerwala | 3392 |
9 | Um_nik | 3392 |
# | User | Contrib. |
---|---|---|
1 | cry | 169 |
2 | maomao90 | 162 |
2 | Um_nik | 162 |
4 | atcoder_official | 161 |
5 | djm03178 | 158 |
6 | -is-this-fft- | 157 |
7 | adamant | 155 |
8 | awoo | 154 |
8 | Dominater069 | 154 |
10 | luogu_official | 150 |
Recently I read about LiChao Tree for convex hull trick, however I couldn't find any resource on internet showing on how to perform delete operations on LiChao trees. Is it even possible to do delete operations on such segment tree?
Name |
---|
Deleting from Li Chao tree can be done using this technique.
Sorry about commenting so late here, but how can we store the changes to the LiChao tree, do we need to keep all logN values of the path from the root to the leaf in the tree?
Just make the LiChao persistent, it should be as easy as any persistent structure, and then do the DynaCon D&C trick to support deletes. Note that this only support deleting in an offline way, i don't think its possible in less than sqrt(N) per query for online
You can do it online using SQRT with rebuilding. Maintaing bins with size at most K, everytime you insert some line, try to insert in some open bin or open a new bin, for each bin, keep the CHT of the lines in the bin as well. For a query operation, just pass for each N/K bins and keep the min/max of querys in the CHTs of the bins. For a delete operation, find the bin that the line is, erase the line and rebuild the entire bin.
You can choose K that minimize O(N/K * log(N)) + O(K)