Reference. Truly Functional Solutions to the Longest Uptrend Problem (Functional Pearl)
Solutions to the longest increasing subsequence problem are typically implemented imperatively, relying on arrays for constant-time lookups and updates. Replacing these arrays with functional sequences allows a purely functional solution with the same asymptotic running time, but with significantly worse practical performance. In this pearl, we present a purely functional approach that is not only asymptotically optimal, but also efficient in practice. The core idea is to exploit the interplay between search, lookup, and update operations through Huet’s zipper. In addition, we improve the adaptive behaviour of imperative solutions commonly found in the literature.
Cite
Cites 9 works (2 here)
With notes (2)
Binary search—think positive dinges-2025-binary
Algorithm Design with Haskell bird-2020-algorithm
External (7)
- Truly Functional Solutions to the Longest Uptrend Problem (Functional Pearl) Artifact (2025)
- The Derivative of a Regular Type is its Type of One-Hole Contexts (2001)
- Red-black trees in a functional setting (1999)
- Constructing Red-Black Trees (1999)
- The Zipper (1997)
- A Method of Programming (1988)
- The Science of Programming (1981)