Hostname: page-component-77f85d65b8-lfk5g Total loading time: 0 Render date: 2026-03-27T05:13:21.647Z Has data issue: false hasContentIssue false

Deletion: The curse of the red-black tree

Published online by Cambridge University Press:  11 September 2014

KIMBALL GERMANE
Affiliation:
University of Utah, UT, USA (e-mail: krgermane@gmail.com)
MATTHEW MIGHT
Affiliation:
University of Utah, UT, USA (e-mail: krgermane@gmail.com)
Rights & Permissions [Opens in a new window]

Abstract

Core share and HTML view are not available for this content. However, as you have access to this content, a full PDF is available via the 'Save PDF' action button.

Okasaki introduced the canonical formulation of functional red-black trees when he gave a concise, elegant method of persistent element insertion. Persistent element deletion, on the other hand, has not enjoyed the same treatment. For this reason, many functional implementations simply omit persistent deletion. Those that include deletion typically take one of two approaches. The more-common approach is a superficial translation of the standard imperative algorithm. The resulting algorithm has functional airs but remains clumsy and verbose, characteristic of its imperative heritage. (Indeed, even the term insertion is a holdover from imperative origins, but is now established in functional contexts. Accordingly, we use the term deletion which has the same connotation.) The less-common approach leverages the features of advanced type systems, which obscures the essence of the algorithm. Nevertheless, foreign-language implementors reference such implementations and, apparently unable to tease apart the algorithm and its type specification, transliterate the entirety unnecessarily. Our goal is to provide for persistent deletion what Okasaki did for insertion: a succinct, comprehensible method that will liberate implementors. We conceptually simplify deletion by temporarily introducing a “double-black” color into Okasaki's tree type. This third color, with its natural interpretation, significantly simplifies the preservation of invariants during deletion.

Information

Type
Functional Pearl
Copyright
Copyright © Cambridge University Press 2014 
Submit a response

Discussions

No Discussions have been published for this article.