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 DocumentRight Arrow Icon
Deleting an Element from a BST b Algorithm: Find the node to delete, delete it b When deleting a node from a BST, there are 3 cases to consider s The node is a leaf; it has no children. This is the easiest case to deal with s The node has one child. This case is not complicated s 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 DocumentRight 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 DocumentRight 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 DocumentRight 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 (contd) 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 (contd) Deleting an Element from a BST b Algorithm (DONE IN CLASS)...
View Full Document

This note was uploaded on 11/26/2009 for the course MATH AND C CSCI255 taught by Professor Dr.ikergondraluja during the Spring '09 term at St. Francis Xavier, Antigonish.

Page1 / 8

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

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online