Docsity

Data Structures: Case-Based Analysis of Binary Tree Operations (Insertion and Deletion), Lecture notes of Data Structures and Algorithms

Partial preview of the text

Download Data Structures: Case-Based Analysis of Binary Tree Operations (Insertion and Deletion) and more Lecture notes Data Structures and Algorithms in PDF only on Docsity!

Operations

Insertion

  • (^) Case 1: The current node N is at the root of the tree.

Insertion

  • (^) Case 2: The current node's parent P is black

Insertion

  • (^) Case 4: The parent P is red but the uncle U is black; also, the current node N is the right child of P , and P in turn is the left child of its parent G.

Insertion

  • (^) Case 5: The parent P is red but the uncle U is black, the current node N is the left child of P , and P is the left child of its parent G.

Deletion

Deletion Case 1: N is the new root.

Deletion

Case 3: P , S , and S 's children are black

Deletion

Case 4: S and S 's children are black, but P is red.

Deletion

Case 6: S is black, S 's right child is red, and N is the left child of its parent P.