---
title: "Little-Known Awesome Algorithms: Fenwick Trees – Rapidly Find Cumulative Frequen"
author: "standalone"
date: "2012-09-28T17:28:50Z"
tags: []
categories: ["非技术"]
slug: "little-known-awesome-algorithms-fenwick-trees-rapidly-find-cumulative-frequen"
draft: false
lastmod: "2012-09-28T17:28:50Z"
id: 1688175
url: "https://standalone.iteye.com/blog/1688175"
---

<http://www.swageroo.com/wordpress/little-known-awesome-algorithms-fenwick-range-trees-rapidly-find-cumulative-frequency-sums/>


This is to solve range query problems. Questions can be like below


> Imagine that we are creating an analytics tool for a financials brokerage, where orders are coming in all the time. Let’s say we’re interested in knowing how many orders fall between a certain value (a range query), in real-time. Lets say that orders can fall between $0.01 and $5M, and we want to let our clients query at any given time how many orders have gone through so far that fall between any $x and $y.