---
id: PURQ
title: "Point Update Range Query"
author: Benjamin Qi
prerequisites: 
description: Range queries for any associative operation over an array with updates using segment tree.
frequency: 1
---

import { Problem } from "../models";

export const metadata = {
  problems: {
    sample: [
      new Problem("YS", "Point Set Range Composite", "point_set_range_composite", "Intro", false, ["PURQ"], ""),
    ],
    general: [
      new Problem("CSES", "Range Minimum Queries II", "1649", "Intro", false, ["PURQ"], ""),
      new Problem("Gold", "Springboards", "995", "Normal", false, ["PURQ"], "min segtree"),
      new Problem("Plat", "Nocross", "721", "Normal", false, ["PURQ"], "LIS variation"),
    ]
  }
};

<problems-list problems={metadata.problems.sample} />

<br/>

A **segment tree** allows you to do point update and range query in $O(\log N)$ time each for any associative operation. 

<info-block title="Pro Tip">

For gold, you only need to know the basics (ex. sum, min queries). More advanced applications (such as *lazy propagation*) are restricted to platinum.

</info-block>

### Tutorials

<resources>
  <resource source="CSA" title="Segment Trees" url="segment_trees" starred>interactive</resource>
  <resource source="CF" title="Efficient and easy segment trees" url="blog/entry/18051" starred>simple implementation</resource>
  <resource source="CPH" title="9.3 - Segment Trees" starred>same implementation as above</resource>
  <resource source="cp-algo" title="Segment Tree" url="data_structures/segment_tree.html"></resource>
  <resource source="PAPS" title="11.2.3"></resource>
  <resource source="CPC" title="3 - Data Structures" url="03_data_structures"></resource>
</resources>

### Problems

Can also try solving some of the BIT questions w/ segtree.

<problems-list problems={metadata.problems.general} />
