Skip to main content Accessibility help
×
Home
Hostname: page-component-56f9d74cfd-rbfsf Total loading time: 0.288 Render date: 2022-06-26T18:58:21.396Z Has data issue: true Feature Flags: { "shouldUseShareProductTool": true, "shouldUseHypothesis": true, "isUnsiloEnabled": true, "useRatesEcommerce": false, "useNewApi": true }

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

HTML view is 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.

Type
Functional Pearl
Copyright
Copyright © Cambridge University Press 2014 

References

Appel, A. W. (2011) Efficient verified red-black trees.Google Scholar
Appel, A. & MacQueen, D. (1991) Standard ml of new jersey. In Programming Language Implementation and Logic Programming. Springer, pp. 113. Springer Berlin Heidelberg.Google Scholar
Bertot, Y. & Castéran, P. (2004) Interactive Theorem Proving and Program Development: Coq'art: the Calculus of Inductive Constructions. Springer. Springer-Verlag Berlin Heidelberg.CrossRefGoogle Scholar
Cormen, T. H., Leiserson, C. E., Rivest, R. L. & Stein, C. (2001) Introduction to Algorithms, vol. 2. The MIT press Cambridge. The MIT Press Cambridge.Google Scholar
Dybvig, R. K. (2003) The Scheme Programming Language. The MIT Press. The MIT Press Cambridge.Google Scholar
Filliâtre, J.-C. & Letouzey, P. (2004) Functors for proofs and programs. In Programming languages and systems. pp. 370–384.Google Scholar
Flatt, M. & PLT. (2010) Reference: Racket. Tech. rept. http://racket-lang.org/tr1/.Google Scholar
Hinze, R. et al. (1999) Constructing red-black trees. In Proceedings of the Workshop on Algorithmic Aspects of Advanced Programming Languages, vol. 99, pp. 89–99.Google Scholar
Huet, G. (1997) The zipper. J. Funct. Program. 7 (05), 549554.CrossRefGoogle Scholar
Kahrs, S. (2001) Red-black trees with types. J. Funct. Program. 11 (04), 425432.CrossRefGoogle Scholar
Odersky, M. (2009) The scala language specification, version 2.8. Epfl lausanne, switzerland.Google Scholar
Okasaki, C. (1999) Red-black trees in a functional setting. J. Funct. Program. 9 (04), 471477.CrossRefGoogle Scholar
Peyton Jones, S. (2003) Haskell 98 Language and Libraries: The Revised Report. Cambridge University Press.Google Scholar
Submit a response

Discussions

No Discussions have been published for this article.
You have Access

Save article to Kindle

To save this article to your Kindle, first ensure coreplatform@cambridge.org is added to your Approved Personal Document E-mail List under your Personal Document Settings on the Manage Your Content and Devices page of your Amazon account. Then enter the ‘name’ part of your Kindle email address below. Find out more about saving to your Kindle.

Note you can select to save to either the @free.kindle.com or @kindle.com variations. ‘@free.kindle.com’ emails are free but can only be saved to your device when it is connected to wi-fi. ‘@kindle.com’ emails can be delivered even when you are not connected to wi-fi, but note that service fees apply.

Find out more about the Kindle Personal Document Service.

Deletion: The curse of the red-black tree
Available formats
×

Save article to Dropbox

To save this article to your Dropbox account, please select one or more formats and confirm that you agree to abide by our usage policies. If this is the first time you used this feature, you will be asked to authorise Cambridge Core to connect with your Dropbox account. Find out more about saving content to Dropbox.

Deletion: The curse of the red-black tree
Available formats
×

Save article to Google Drive

To save this article to your Google Drive account, please select one or more formats and confirm that you agree to abide by our usage policies. If this is the first time you used this feature, you will be asked to authorise Cambridge Core to connect with your Google Drive account. Find out more about saving content to Google Drive.

Deletion: The curse of the red-black tree
Available formats
×
×

Reply to: Submit a response

Please enter your response.

Your details

Please enter a valid email address.

Conflicting interests

Do you have any conflicting interests? *