Content deleted Content added
→Dynamic range queries: Fenwick tree is also a relevant data structure. |
→Prefix sum array: Add 2-dimensional example. |
||
Line 12:
{{Main|Prefix sum}}
Range sum queries may be answered in [[constant time]] and [[space complexity|linear space]] by pre-computing an array {{mvar|p}} of same length as the input such that for every index {{mvar|i}}, the element {{mvar|p<
This strategy may be extended to any other [[binary operation]] <math>f</math> whose [[inverse function]] <math>f^{-1}</math> is well-defined and easily computable.<ref name="morin">{{cite journal|first1=Danny|last1=Krizanc|first2=Pat|last2=Morin|author2-link= Pat Morin |first3=Michiel H. M.|last3=Smid|title=Range Mode and Range Median Queries on Lists and Trees|journal=ISAAC|year=2003|pages=517–526|url=http://cg.scs.carleton.ca/~morin/publications/|arxiv=cs/0307034|bibcode=2003cs........7034K }}</ref> It can also be extended to
===Dynamic range queries===
|