{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

lecture20 - case Deleting a Leaf Deleting a Node with One...

Info iconThis preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon
CSCI-255 Advanced Data Structures Lecture 20
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Deleting an Element from a BST box3 Algorithm: Find the node to delete, delete it box3 When deleting a node from a BST, there are 3 cases to consider square6 The node is a leaf; it has no children. This is the easiest case to deal with square6 The node has one child. This case is not complicated square6 The node has two children. The most complicated
Background image of page 2
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Background image of page 4
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Background image of page 6
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Background image of page 8
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: case Deleting a Leaf Deleting a Node with One Child Deleting a Node with One Child (cont’d) Deleting a Node with Two Children b Find the rightmost node in the left subtree (WHY?) and swap data between these 2 nodes Deleting a Node with Two Children (cont’d) Deleting an Element from a BST b Algorithm (DONE IN CLASS)...
View Full Document

{[ snackBarMessage ]}