Question
2.(15pts) Fill in the blanks to complete the deletion algorithm from a binary search tree using the notation given in class. delete( T: binary search
2.(15pts) Fill in the blanks to complete the deletion algorithm from a binary search tree using the notation given in class.
delete( T: binary search tree, x )
### The algorithm just changes T returning nothing
if T is empty
______(a)_____
else if x< label(root(T))
delete(____(b)____, x)
else if x > label(root(T))
delete(____(c)____, x)
else if right(T) is empty
replace T by ____(d)____
else
v = node in ____(e)____ including the ____(f)____ value in ____(g)____
label(____(h)___) = label(v)
move ____(i)____ under ____(j)____
Fill-in Choices: (1) root(T), (2) left(T), (3) right(T),
(4) left(v), i.e., the left subtree of the node v,
(5) right(v), i.e., the right subtree of the node v,
(6) parent(v), i.e., the parent node of v,
(7) smallest, (8) largest, (9) do nothing, (10) return T, (11) None of the above.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started