Binomial Heaps Lecture 18
Source: internet These lecture slides are adopted from CLRS, Chapters 6, 19.
Representing Binomial Heaps
6 29 1 25 10 14 38
8 11 27 17
12 18
Each node is represented by a structure like this
parent key degree child sibling
2
Bino
Binomial Heaps Lecture 17
Source: internet These lecture slides are adopted from CLRS, Chapters 6, 19.
Binomial Tree
Binomial tree.
s
Recursive definition:
B0
Bk
Bk-1 Bk-1
B0
B1
B2
B3
B4
2
Binomial Tree
Useful properties of order k binomial tree Bk.
s
Num
Binary and Binomial Heaps Lecture 16
Source: internet These lecture slides are adopted from CLRS, Chapters 6, 19.
Binary Heap: Definition
Binary heap.
s
Almost complete binary tree. filled on all levels, except last, where filled from left to right Min-he
RB Insert: Case 1
if (y->color = RED) x->p->color = BLACK; y->color = BLACK; x->p->p->color = RED; x = x->p->p;
Case 1: uncle is red In figures below, all s are
equal-black-height subtrees
C A Dy Bx
case 1
C new x A D B
Change colors of some nodes, prese
CS 6713 Advanced Analysis of Algorithms
Lecture 08 Red-Black Trees (contd)
Sources: Dr. David Luebkes slides Internet 1
2
Red-Black Trees: Insertion
Insertion: the basic idea Insert x into tree, color x red Only r-b property 3 might be violated (if p[x]
CS 6713 Advanced Analysis of Algorithms
Lecture 07 Red-Black Trees (contd)
Sources: Dr. David Luebkes slides Internet 1
2
Red-Black Properties
The red-black properties:
1. Every node is either red or black 2. Every leaf (NULL pointer) is black
Note: thi
CS 6713 Advanced Analysis of Algorithms
Lecture 06 Red-Black Trees (contd)
Sources: Dr. David Luebkes slides
Review: Binary Search Trees
BST property: key[left(x)] key[x] key[right(x)] More precisely, [all the keys in xs left subtree] key[x] [all the key
CS 6713 Advanced Analysis of Algorithms
Lecture 05 Red-Black Trees
Sources: Dr. David Luebkes slides Dr. Dan Gildeas slides
Review: Binary Search Trees
Binary Search Trees (BSTs) are an important
data structure for dynamic sets In addition to satellite d