SlideServe
Menu
Préférences
© SlideServe · v2026

Red - Black Trees

allene avatar
21 diapositives · 399 Views · Aug 10, 2014

Red - Black Trees. Acknowledgment Many thanks to “ erm ” from Purdue University for this very interesting way of presenting this course material. Red -Black Tree. A red -black tree is a binary search tree with the following properties: • edges are colored red or black

Red - Black Trees - slide 1
01 / 21Red - Black Trees
1 / 17

Télécharger la présentation

Red - Black Trees
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. Red-Black Trees Acknowledgment Many thanks to “erm” from Purdue University for this very interesting way of presenting this course material.

  2. Red-Black Tree • A red-black tree is a binary search treewith thefollowing properties: • • edges are colored red or black • • no two consecutive red edgeson any root-leaf path • • same number of black edgeson any root-leaf path • (= black height of the tree) • • edges connecting leaves are black

  3. Correspondence between2-3-4 and Red-Black trees Notice that red-black trees are just a way ofrepresenting 2-3-4 trees!

  4. More Red-Black Tree Properties

  5. Insertion into Red-Black Trees 1.Perform a standard search to find the leaf where the key should be added 2.Replace the leaf with an internal node with the new key 3.Color the incoming edge of the new node red 4. Add two new leaves, and color their incoming edges black 5.If the parent had an incoming red edge, we have two consecutive red edges! We mustreorganize tree to remove that violation. What must be done depends on the sibling of the parent.

  6. Insertion: an example Start by inserting “REDSOX” into an empty tree