{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

notes 57 - CS251 Class Notes(2,4 Tree Deletion Deletion...

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

View Full Document Right Arrow Icon
CS251 Class Notes 03-06-06 (2,4) Tree Deletion Deletion: - Find key with a simple multi-way search from the root. o Case 1: if the node found has external children, just remove the key o Case 2: if the item to delete has no external children - Find the item that precedes in-order traversal - Put this item instead of the item to remove
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
- All removals of keys of internal nodes can be simplified this way. o Case 3: if the key to remove is the last key in the node, removing the key will cause an underflow. - pull a key from the parent and replace it with a key from
Background image of page 2
a sibling. This is called a Transfer. o Case 4: assume the sibling has only one key. If this is the case we fuse the children after taking one item from the parent.
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
(Fusion) This underflow can cascade up to the top of the tree.
Background image of page 4
Another Example All the steps for Remove can be done in O(log n) = height. In (2,4) trees, Insert, Lookup, and remove can be done in O(log n) RED-BLACK TREE
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
is a binary tree with the following properties: 1.
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}