Question: Suppose we want to create a binary search tree by inserting the following values in the given order: 1 5 , 6 , 1 8
Suppose we want to create a binary search tree by inserting the following values in
the given order:
Answer the following questions.
Draw the binary search tree.
Using the BST in question show that that the number of nodes examined in searching
for a value in the tree is one plus the number of nodes examined when the value was
first inserted into the tree.
Write algorithms for the following tasks:
a Find successor of a node in a BST
b Find predecessor of a node in a BST
c Count occurrences of a number in a BST
d Alternative method of performing inorder walk in a BST Hints: Find minimum
element and then find the successors of the minimum element
Show that if the right subtree of a node in the BST of question is empty and
has a successor then is the lowest ancestor of whose left child is also
an ancestor of
Let be a leaf node, and let be its parent. Using the BST in question show
that key is either the smallest key larger than xkey or the largest key smaller
than xkey.
Show the resulting trees after we delete and from the BST in question
each deletion is applied on the original tree
Is the operation of deletion "commutative" in the sense that deleting and then
from a binary search tree leaves the same tree as deleting and then Argue why
it is or give a counterexample.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
