Bottom-up computation using trees of sublists
Сохранить в:
| Опубликовано в:: | Journal of Functional Programming vol. 34 (Dec 2024) |
|---|---|
| Главный автор: | |
| Опубликовано: |
Cambridge University Press
|
| Предметы: | |
| Online-ссылка: | Citation/Abstract Full Text - PDF |
| Метки: |
Нет меток, Требуется 1-ая метка записи!
|
| Краткий обзор: | Some top-down problem specifications, if executed, may compute sub-problems repeatedly. Instead, we may want a bottom-up algorithm that stores solutions of sub-problems in a table to be reused. How the table can be represented and efficiently maintained, however, can be tricky. We study a special case: computing a function <inline-formula><inline-graphic mime-subtype="png" xlink:href="S0956796824000145_inline1.png" />\({\mathit{h}}\)</inline-formula> taking lists as inputs such that <inline-formula><inline-graphic mime-subtype="png" xlink:href="S0956796824000145_inline2.png" />\({\mathit{h}\;\mathit{xs}}\)</inline-formula> is defined in terms of all immediate sublists of <inline-formula><inline-graphic mime-subtype="png" xlink:href="S0956796824000145_inline3.png" />\({\mathit{xs}}\)</inline-formula>. Richard Bird studied this problem in 2008 and presented a concise but cryptic algorithm without much explanation. We give this algorithm a proper derivation and discovered a key property that allows it to work. The algorithm builds trees that have certain shapes—the sizes along the left spine is a prefix of a diagonal in Pascal’s triangle. The crucial function we derive transforms one diagonal to the next. |
|---|---|
| ISSN: | 0956-7968 1469-7653 |
| DOI: | 10.1017/S0956796824000145 |
| Источник: | Advanced Technologies & Aerospace Database |