Preview

Red-Black Tree: Maintaining Red-Black Properties

Better Essays
Open Document
Open Document
2558 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Red-Black Tree: Maintaining Red-Black Properties
Red-Black Tree

Abstract--In this paper, Red-Black Tree is discussed and various operations that can be performed on it are illustrated. The operations include rotation/restructuring (Left-Rotation and Right-Rotation), inserting a node in Red-Black Tree and deleting a node from Red-Black Tree thereby maintaining its Red-Black Properties.
I. Introduction
A fascinating and important balanced binary search tree is the red-black tree. Rudolf Bayer invented this important tree structure in 1972, about 10 years after the introduction of AVL trees. Bayer referred to his red-black trees as “symmetric binary B-trees.”
Red-black trees, as they are now known, like AVL trees, are “self-balancing”. Whenever a new object is inserted or deleted, the resulting tree continues to satisfy the conditions required to be a red-black tree. The computational complexity for insertion or deletion can be shown to be O (log N), similar to an AVL tree. The rules that define a red-black tree are interesting because they are less constrained than the rather strict rules associated with an AVL tree. Each node is assigned a color of red or black [1].
Insertion and deletion operations on red-black trees are more complex to describe or to code than the same operations on AVL trees. Red-black trees also have a higher maximum height than AVL trees for a given number of nodes. The primary advantage of red-black trees is that, in AVL trees, deleting one node from a tree containing n nodes may require log2 n rotations, but deletion in a red-black tree never requires more than three rotations [2].

A. Definition
A red-black tree is a binary search tree with one extra attribute for each node: the color, which is either red or black.
Formally, it is defined as: A red-black tree (RBT) is a binary search tree that satisfies the following red-black properties:
1. Every node has a color that is either red or black.
2. Every leaf is black.
3. If a node is red, both its children are black.
4.



References: [1] en.wikipedia.org/wiki/Red–black_tree [2] Ben Pfaff , “An Introduction to Binary Search Trees and Balanced Trees”, Stanford University, Computer Science Dept. 2002. [3]cs.iupui.edu/~xkzou/teaching/.../Red-black_trees [4] S. Sahni, “Data Structures, Algorithms, and Applications in C++”, McGraw-Hill, 1998.

You May Also Find These Documents Helpful

  • Good Essays

    ECET 370 Week 5 Lab 5

    • 650 Words
    • 3 Pages

    Exercise 1: Review of the Lecture Content Create a project using the ArrayList class and the Main class provided in DocSharing. The ArrayList class contains implementations of the first three search methods explained in this week's lecture: sequential, sorted, and binary search. The Main class uses these three methods. These programs test the code discussed in the lecture. Compile the project, run it, and review the code that is given carefully.…

    • 650 Words
    • 3 Pages
    Good Essays
  • Good Essays

    Nt1310 Unit 1 Test Paper

    • 381 Words
    • 2 Pages

    3. Create a binary search function that tells whether a given value exists in the tree or not.…

    • 381 Words
    • 2 Pages
    Good Essays
  • Satisfactory Essays

    Unit 7 Quiz 5

    • 507 Words
    • 9 Pages

    The ______________ is a database of all object names in the forest and aids in locating objects…

    • 507 Words
    • 9 Pages
    Satisfactory Essays
  • Powerful Essays

    Searching and Sorting Streams and Files Graphics GUI Components and Events Mouse, Keyboard, Sounds, and Images Big-O Analysis of Algorithms The Java Collections Framework Lists and Iterators Stacks and Queues Recursion Revisited Binary Trees Lookup Tables and Hashing Heaps and Priority Queues Design Patterns…

    • 3908 Words
    • 16 Pages
    Powerful Essays
  • Good Essays

    The three characters that relate to me are the three characters I aspire to be.The three fictional characters that most represent my personality are Pig from Back at the Barnyard for his/her companionship, Rick from Rick and Morty for his/her way of questioning things, and Naruto for his/her determination.…

    • 338 Words
    • 2 Pages
    Good Essays
  • Good Essays

    When you think of children, what was the first thing that comes to mind? Reckless? Young? Naïve? Gullible? Into the Wild, by Jon Krakauer, is a book written about an extraordinary but childlike man who set out on a quest, looking for an adventure of being surrounded by nature. Chris McCandless, who the book is based off of, was a man of wonder. No one was ever certain about what he thought, how he felt, or why he went on this suicide journey. Was it because of his childlike recklessness? Or was it something deeper? Chris McCandless was reckless and along with that came passion, loneliness, and despair. So, can we really judge him when he made the decision to live in the most wild parts of the Alaskan state?…

    • 802 Words
    • 4 Pages
    Good Essays
  • Good Essays

    Binary files play an important role in data storage because they are very compact for any given amount of data to be stored. Compactness of storage is critically important for any type of situation involving computers, so binary files are specific to a particular application. New types of data storage must be easy to create and maintain, not just compact. XML plays a part in a process of making data easier to structure and describe. Data structures that can be easily modified or adapted, together with processors that access data contained in those structures, make it easier to create, maintain, and modify data storage than when using binary files alone. (Watt, 2003)…

    • 703 Words
    • 3 Pages
    Good Essays
  • Better Essays

    Symbol Table

    • 1792 Words
    • 8 Pages

    A symbol table mechanism must allow us to add new entries and find existing entries. The two symbol table mechanisms are linear lists and hash tables. Each scheme is evaluated on the basis of time required to add n entries and make e inquiries. A linear list is the simplest to implement, but its performance is poor when n and e are large. Hashing schemes provide better performance for greater programming effort and space overhead.…

    • 1792 Words
    • 8 Pages
    Better Essays
  • Best Essays

    Open Flow

    • 2946 Words
    • 12 Pages

    [5] C. E. Leiserson. Fat-trees: Universal networks for hardware-efficient supercomputing. IEEE Transactions on Computers, 1985.…

    • 2946 Words
    • 12 Pages
    Best Essays
  • Best Essays

    More details can be found in [7]. 1We use the standard notation B to denote the block size, andN the total number of elements inserted. For the analysis, we assume entries (including pointers) are of equal size, so B is the number of entries per block. A versioned B-tree is of great interest to storage and file systems. In 1986, Driscoll et al.…

    • 4093 Words
    • 17 Pages
    Best Essays
  • Powerful Essays

    Irrelevant Speech Effect

    • 1971 Words
    • 8 Pages

    Neath, Ian, Greg Francis, and Daniel R. VanHorn. "Visual Search." CogLab on a CD, 2.0.…

    • 1971 Words
    • 8 Pages
    Powerful Essays
  • Good Essays

    Native to a large portion of the Eastern United States, the Eastern Redbud is a great tree for adding color to your landscaping in the early spring. That is when the tree produces its beautiful pink flowers. It can also be used to provide shade throughout the summer, whether for your home or simply to create a shady area in your…

    • 921 Words
    • 4 Pages
    Good Essays
  • Good Essays

    Binary search tree: binary tree with the property that for every node X, the value of all items in its left subtree are < X and the value of all items in the right subtree are > X…

    • 1611 Words
    • 7 Pages
    Good Essays
  • Better Essays

    Datacube Computation

    • 4285 Words
    • 18 Pages

    – Smallest-child: computing a cuboid from the smallest, previously computed cuboid – Cache-results: caching results of a cuboid from which other cuboids are computed to reduce disk I/Os – Amortize-scans: computing as many as possible cuboids at the same time to amortize disk reads – Share-sorts: sharing sorting costs cross multiple cuboids when sort-based method is used – Share-partitions: sharing the partitioning cost across multiple cuboids when hash-based algorithms are used…

    • 4285 Words
    • 18 Pages
    Better Essays
  • Good Essays

    12.1-1 for the set of {1,4,5,10,16,17,21} of keys, draw binary search trees of height 2,3,4,5 and 6…

    • 1551 Words
    • 7 Pages
    Good Essays