lecture-14

C a c a here the right subtree does not have a left

Info iconThis preview shows page 1. Sign up to view the full content.

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

Unformatted text preview: ode –  We delete the node –  And set the left or right pointer in the parent to NULL •  To remove a node with one child –  The parent of the node to be deleted “adopts” the child B Remove A C B A A C C Remove A C B B CPSC 223  ­ ­ Fall 2010 32 16 10/19/10 Removing Nodes •  Hardest Case: Remove a node with two children –  Both children cannot be “adopted” by the parent D D Remove B ? B A C A C CPSC 223  ­ ­ Fall 2010 33 Removing Nodes •  To remove a node with two children –  one solution is to not delete the node … –  and instead replace the item in the node with another node’s item D D Remove B B A ? C A...
View Full Document

This document was uploaded on 03/18/2014 for the course CPSC 223 at Gonzaga.

Ask a homework question - tutors are online