---
# System prepended metadata

title: Resourses for Range Queries

---

# Resourses for Range Queries
These are some blogs and videos that can be helpful. I highly recommend practicing a lot of Codeforces problems for each topic, especially segment trees.


## Sparse Table

* [Reading Resource](https://cp-algorithms.com/data_structures/sparse-table.html)
* [Video Resource](https://www.youtube.com/watch?v=0jWeUdxrGm4&t=25s&pp=ygUNc3BhcnNlIHRhYmxlcw%3D%3D)
* [Blog on codeforces](https://codeforces.com/blog/entry/101083)
* [Arpa's Trick](https://cp-algorithms.com/data_structures/disjoint_set_union.html#arpa) (Offline RMQ Queries in  <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>O</mi><mo stretchy="false">(</mo><mi>&#x3B1;</mi><mo stretchy="false">(</mo><mi>n</mi><mo stretchy="false">)</mo><mo stretchy="false">)</mo></math> )

## Fenwick Trees

* [Reading Resource](https://cp-algorithms.com/data_structures/fenwick.html)
* [Video Resource](https://youtu.be/DPiY9wFxGIw?si=V2iX0y4SERlbq0T9)

## Segment Trees

* [Reading Resource](https://cp-algorithms.com/data_structures/segment_tree.html)
* [Usaco Guide](https://usaco.guide/gold/PURS?lang=cpp)
* [Video Resource by Second Thread](https://youtu.be/QvgpIX4_vyA?si=25_3egZmyHkLW0M4)
* [Video Resource by peltorator](https://youtu.be/YbtVrMKmGoA?si=wyWkXga4YyPgucqA)
* [Segtree Beats](https://codeforces.com/blog/entry/57319) (Not neccesary)

[Snippet for segtrees](https://pastebin.com/QhBfx8Jv)