report VI VI EN
Register | Login
  • HOME
  • PROBLEMSET
  • ROADMAP
  • COMPETITION
  • TOPIC
  • RANKING
  • GUIDE
  • MASHUP
  • ABOUT
  • CONTACT
Module Introduction to Segment Tree and Binary Indexed Tree

Introduction to Segment Tree and Binary Indexed Tree

**Frequency: 10/10** Segment trees and binary indexed trees (BIT) are indispensable data structures in competitive programming, enabling efficient range queries and updates over arrays. Generally speaking, Segment Tree is more versatile while BIT have a lower constant factor. Since BIT can be a bit tricky to understand at first, most people choose to start with Segment Tree. And you should choose Segment Tree too.

Resources

- [CP Algorithms: Segment Tree](https://cp-algorithms.com/data_structures/segment_tree.html) - [CP Algorithms: Fenwick Tree](https://cp-algorithms.com/data_structures/fenwick.html)

Problems

Point update, sum query 1011 / 1029 1400
Point update, minimum query 886 / 928 1400
Range update, sum query 821 / 864 1400
Range update, minimum query 753 / 775 1400
Apple picking 494 / 587 1500
Non-negative subarray 495 / 544 1500
Inversions 444 / 455 1500
K-query 489 / 509 1500
Divisible by 3 447 / 476 1500
Mushroom harvesting 276 / 288 1500
KSS 255 / 308 1500
D-query 387 / 413 1600
Greatest subarray sum 346 / 366 1600
Copying data 238 / 247 1600
Within 1 240 / 278 1600
Within 2 235 / 253 1600
Ladder update 245 / 268 1700
Racing 129 / 150 1700
One time 176 / 207 1800
Subarray XOR 158 / 171 1800
String sorting 157 / 196 1900
Odd query 49 / 75 2000
Full sequence 28 / 44 2000

Graph

  • Shortest path
  • 0-1 BFS / Dial's algorithm
  • Multisource BFS / Dijkstra
  • DAG / Topological sort

Data structure

  • Introduction to Segment Tree and Binary Indexed Tree
  • Sparse table
  • Monotonic queue

Tree

  • Lowest common ancestor (LCA)
  • Euler tour

Dynamic Programming

  • Bitmask DP
  • Exchange labels DP
  • Game DP

Math

  • Introduction to combinatorics
  • Inclusion-exclusion principle