Delete 'F', 'E', 'V' from 2-3 Tree

  • Thread starter Thread starter ooohffff
  • Start date Start date
  • Tags Tags
    trees
AI Thread Summary
The discussion focuses on the process of deleting nodes 'F', 'E', and 'V' from a 2-3 tree in a specified order. Participants express uncertainty about the correct deletion method, particularly for node 'V', which has no children, suggesting it can be removed directly. The algorithm mentioned involves replacing a target with the largest item from its left subtree if it has children. There is a request for clarification on how to handle the deletion of 'E' specifically. The conversation emphasizes understanding the deletion process in 2-3 trees.
ooohffff
Messages
74
Reaction score
1

Homework Statement


(P)
/ \
(F) (U)
/ \ / \
(D, E) (J, O) (T) (V)

Given the 2-3 tree, delete F E V from the tree in the given order. Show the tree after each deletion.

Homework Equations


Min = 1
Max = 2

The Attempt at a Solution


unnamed.jpg


Remove 'V' : Not sure what to do here

Am I doing this correctly? The algorithm in my book says to replace the target at data(i) with the largest item in subset(i) (rightmost child of left subtree), if I found the target at a node.
 

Attachments

  • unnamed.jpg
    unnamed.jpg
    32.2 KB · Views: 351
Physics news on Phys.org
Hi,

How about just removing the 'V' node ? It has no subsets, so nothing replaces it.
ooohffff said:
replace the target at data(i) with the largest item in subset(i) (rightmost child of left subtree)
Can you explain how you remove 'E' ?
 
Back
Top