Hacker News new | past | comments | ask | show | jobs | submit login

Does the range query aggregate the elements in range? If the aggregation operation forms a group (follows associativity law, has inverse) you can use prefix sum data structures like Fenwick tree.

If it doesn't have inverse so that you cannot subtract prefix sum, sparse table can be used.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: