A Pedagogically Sound yet Efficient Deletion algorithm for Red-Black Trees: The Parity-Seeking Delete Algorithm

04/09/2020
by   Kamaledin Ghiasi-Shirazi, et al.
0

Red-black (RB) trees are one of the most efficient variants of balanced binary search trees. However, they have always been blamed for being too complicated, hard to explain, and not suitable for pedagogical purposes. Sedgewick (2008) proposed left-leaning red-black (LLRB) trees in which red links are restricted to left children, and proposed recursive concise insert and delete algorithms. However, the top-down deletion algorithm of LLRB is still very complicated and highly inefficient. In this paper, we first consider 2-3 red-black trees in which both children cannot be red. We propose a parity-seeking delete algorithm with the basic idea of making the deficient subtree on a par with its sibling: either by fixing the deficient subtree or by making the sibling deficient, as well, ascending deficiency to the parent node. This is the first pedagogically sound algorithm for the delete operation in red-black trees. Then, we amend our algorithm and propose a parity-seeking delete algorithm for classical RB trees. Our experiments show that, despite having more rotations, 2-3 RB trees are almost as efficient as RB trees and twice faster than LLRB trees. Besides, RB trees with the proposed parity-seeking delete algorithm have the same number of rotations and almost identical running time as the classic delete algorithm. While being extremely efficient, the proposed parity-seeking delete algorithm is easily understandable and suitable for pedagogical purposes.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
04/06/2018

Red-Black Trees with Constant Update Time

We show how a few modifications to the red-black trees allow for O(1) wo...
research
10/14/2019

Dynamic Complexity of Parity Exists Queries

Given a graph whose nodes may be coloured red, the parity of the number ...
research
10/23/2022

A Stack-Free Traversal Algorithm for Left-Balanced k-d Trees

We present an algorithm that allows for find-closest-point and kNN-style...
research
09/20/2023

A Verified Cost Analysis of Joinable Red-Black Trees

Ordered sequences of data, specified with a join operation to combine se...
research
04/07/2020

Zipping Segment Trees

Stabbing queries in sets of intervals are usually answered using segment...
research
06/13/2021

An efficient way to manage ranges of data with Wise Red-Black Trees

This paper describes the most efficient way to manage operations on rang...
research
09/04/2019

About Fibonacci trees III: multiple Fibonacci trees

In this third paper, we revisit the question to which extent the propert...

Please sign up or login with your details

Forgot password? Click here to reset