2020-06-22 01:45:24 +00:00
---
2020-06-22 14:26:06 +00:00
id: PURQ
2020-06-23 17:27:41 +00:00
title: "Point Update Range Query"
2020-06-22 01:45:24 +00:00
author: Benjamin Qi
prerequisites:
2020-06-22 20:51:12 +00:00
- Gold - Point Update Range Sum
2020-06-22 19:59:16 +00:00
description: Range queries for any associative operation over an array with updates, using segment tree.
2020-06-22 01:45:24 +00:00
---
2020-06-22 14:26:06 +00:00
A **segment tree** allows you to do point update and range query in $O(\log N)$ time each for any associative operation. Historically, no gold problem has required the use of a segment tree in place of a binary indexed tree, but it's still good to know (and you might find it simpler).
2020-06-22 01:45:24 +00:00
### Tutorials
2020-06-23 01:00:35 +00:00
- CPH 9.3 (Segment Trees)
- [PAPS 11.2.3](https://www.csc.kth.se/~jsannemo/slask/main.pdf)
2020-06-22 01:45:24 +00:00
- [Codeforces Tutorial](http://codeforces.com/blog/entry/18051)
- [CSAcademy Tutorial](https://csacademy.com/lesson/segment_trees/)
- [cp-algorithms](https://cp-algorithms.com/data_structures/segment_tree.html)
- [Slides from CPC.3](https://github.com/SuprDewd/T-414-AFLV/tree/master/03_data_structures)
### Problems
Can try solving some of the BIT questions w/ segtree.
- CSES
- [Range Minimum Queries II](https://cses.fi/problemset/task/1649)
- just min segtree
- [Subarray Sum Queries](https://cses.fi/problemset/task/1190)
- [Hotel Queries](https://cses.fi/problemset/task/1143)
- Normal SegTree
2020-06-22 14:26:06 +00:00
- [USACO Gold Springboards](http://www.usaco.org/index.php?page=viewproblem2&cpid=995)
- can use segment tree with min query in place of the map mentioned in analysis
2020-06-22 01:45:24 +00:00
- [USACO Old Gold Seating](http://www.usaco.org/index.php?page=viewproblem2&cpid=231) (check ...)
- [USACO Old Gold Optimal Milking](http://www.usaco.org/index.php?page=viewproblem2&cpid=365) (check ...)
- [USACO Old Gold Marathon](http://www.usaco.org/index.php?page=viewproblem2&cpid=495) (check ...)
- [USACO Plat Balancing](http://www.usaco.org/index.php?page=viewproblem2&cpid=624) (check ...)
- [USACO Plat Nocross](http://www.usaco.org/index.php?page=viewproblem2&cpid=721)
2020-06-24 20:50:30 +00:00
- [POI Cards](https://szkopul.edu.pl/problemset/problem/qpsk3ygf8MU7D_1Es0oc_xd8/site/?key=statement) [](81)