You could have invented Fenwick trees
Guardado en:
| Publicado en: | Journal of Functional Programming vol. 35 (Jan 2025) |
|---|---|
| Autor principal: | |
| Publicado: |
Cambridge University Press
|
| Materias: | |
| Acceso en línea: | Citation/Abstract Full Text - PDF |
| Etiquetas: |
Sin Etiquetas, Sea el primero en etiquetar este registro!
|
| Resumen: | Fenwick trees, also known as binary indexed trees are a clever solution to the problem of maintaining a sequence of values while allowing both updates and range queries in sublinear time. Their implementation is concise and efficient—but also somewhat baffling, consisting largely of nonobvious bitwise operations on indices. We begin with segment trees, a much more straightforward, easy-to-verify, purely functional solution to the problem, and use equational reasoning to explain the implementation of Fenwick trees as an optimized variant, making use of a Haskell EDSL for operations on infinite two’s complement binary numbers. |
|---|---|
| ISSN: | 0956-7968 1469-7653 |
| DOI: | 10.1017/S0956796824000169 |
| Fuente: | Advanced Technologies & Aerospace Database |