Kamaledin Ghiasi-Shirazi, Taraneh Ghandi, Ali Taghizadeh, Ali Rahimi-Baigi
{"title":"Revisiting 2–3 red–black trees with a pedagogically sound yet efficient deletion algorithm: parity-seeking","authors":"Kamaledin Ghiasi-Shirazi, Taraneh Ghandi, Ali Taghizadeh, Ali Rahimi-Baigi","doi":"10.1007/s00236-023-00452-6","DOIUrl":null,"url":null,"abstract":"<div><p>Red–black (RB) trees are one of the most efficient variants of balanced binary search trees. However, they have often been criticized for being too complicated, hard to explain, and unsuitable for pedagogical purposes, particularly their delete operation. Sedgewick (in: Dagstuhl Workshop on Data Structures, 2008. https://sedgewick.io/wp-content/themes/sedgewick/papers/2008LLRB.pdf) identified the length of code as the root of the problems and introduced left-leaning red–black (LLRB) trees. The delete operation of LLRB trees has a compact recursive code. Unfortunately, it may perform many unnecessary operations. The crux of the deletion algorithm is dealing with a “deficient” subtree, that is one whose black-height has become one less than that of its sibling subtree. In this paper, we revisit 2–3 red–black trees and propose a parity-seeking delete algorithm with the basic idea of making a deficient subtree on a par with its sibling: either by fixing the deficient subtree or by turning the sibling deficient as well, ascending deficiency to the parent node. Interestingly, the proposed parity-seeking <i>delete</i> algorithm also works for 2–3–4 RB trees. Our experiments show that the proposed parity-seeking delete algorithm is as efficient as the best preceding RB trees. The proposed parity-seeking delete algorithm is easily understandable and suitable for pedagogical and practical purposes.</p></div>","PeriodicalId":7189,"journal":{"name":"Acta Informatica","volume":"61 3","pages":"199 - 229"},"PeriodicalIF":0.4000,"publicationDate":"2024-03-29","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Acta Informatica","FirstCategoryId":"94","ListUrlMain":"https://link.springer.com/article/10.1007/s00236-023-00452-6","RegionNum":4,"RegionCategory":"计算机科学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"Q4","JCRName":"COMPUTER SCIENCE, INFORMATION SYSTEMS","Score":null,"Total":0}
引用次数: 0
Abstract
Red–black (RB) trees are one of the most efficient variants of balanced binary search trees. However, they have often been criticized for being too complicated, hard to explain, and unsuitable for pedagogical purposes, particularly their delete operation. Sedgewick (in: Dagstuhl Workshop on Data Structures, 2008. https://sedgewick.io/wp-content/themes/sedgewick/papers/2008LLRB.pdf) identified the length of code as the root of the problems and introduced left-leaning red–black (LLRB) trees. The delete operation of LLRB trees has a compact recursive code. Unfortunately, it may perform many unnecessary operations. The crux of the deletion algorithm is dealing with a “deficient” subtree, that is one whose black-height has become one less than that of its sibling subtree. In this paper, we revisit 2–3 red–black trees and propose a parity-seeking delete algorithm with the basic idea of making a deficient subtree on a par with its sibling: either by fixing the deficient subtree or by turning the sibling deficient as well, ascending deficiency to the parent node. Interestingly, the proposed parity-seeking delete algorithm also works for 2–3–4 RB trees. Our experiments show that the proposed parity-seeking delete algorithm is as efficient as the best preceding RB trees. The proposed parity-seeking delete algorithm is easily understandable and suitable for pedagogical and practical purposes.
期刊介绍:
Acta Informatica provides international dissemination of articles on formal methods for the design and analysis of programs, computing systems and information structures, as well as related fields of Theoretical Computer Science such as Automata Theory, Logic in Computer Science, and Algorithmics.
Topics of interest include:
• semantics of programming languages
• models and modeling languages for concurrent, distributed, reactive and mobile systems
• models and modeling languages for timed, hybrid and probabilistic systems
• specification, program analysis and verification
• model checking and theorem proving
• modal, temporal, first- and higher-order logics, and their variants
• constraint logic, SAT/SMT-solving techniques
• theoretical aspects of databases, semi-structured data and finite model theory
• theoretical aspects of artificial intelligence, knowledge representation, description logic
• automata theory, formal languages, term and graph rewriting
• game-based models, synthesis
• type theory, typed calculi
• algebraic, coalgebraic and categorical methods
• formal aspects of performance, dependability and reliability analysis
• foundations of information and network security
• parallel, distributed and randomized algorithms
• design and analysis of algorithms
• foundations of network and communication protocols.