Give the binary search tree
after the insert operation
put("www")before
rebalancing the AVL tree
In your answer, lable the nodes
x,
y and
z
that will be used
in the tri-node restructure operation.
The node x is the
first unbalance node,
node y is a child node
of x and
node z is a child node of
y.
Show the AVL tree
after the rebalancing operation:
Insert in AVL tree
Consider the same AVL tree:
Questions:
Give the binary search tree
after the insert operation
put("abm")before
rebalancing the AVL tree
Mark in your answer the nodes
x,
y and
z used
in the rebalance operation.
The node x is the
first unbalance node,
node y is a child node
of x and
node z is a child node of
y.
Show the AVL tree
after the rebalancing operation
Delete in AVL tree
Consider the same AVL tree:
Questions:
Give the binary search tree
after the insert operation
remove("cap")before
rebalancing the AVL tree
Mark in your answer the nodes
x,
y and
z used
in
each of
the rebalance operation(s).
The node x is the
first unbalance node,
node y is a child node
of x and
node z is a child node of
y.
Show the AVL tree
after each
rebalancing operation
Delete in AVL tree
Consider the same AVL tree:
Questions:
Give the binary search tree
after the insert operation
remove("sac")before
rebalancing the AVL tree
Mark in your answer the nodes
x,
y and
z used
in
each of
the rebalance operation(s).
The node x is the
first unbalance node,
node y is a child node
of x and
node z is a child node of
y.
Show the AVL tree
after each
rebalancing operation
Developing an algorithm to find the successor node in a BST
I will use 4 examples to help you figure out what to do
to find the successor of a node in a BST.
Find the path from the node
klm
to its successor
(notice that klm has a non-empty right subtree):
Find the path from the node
sad
to its successor
(notice that klm has a non-empty right subtree):
Find the path from the node
cap
to its successor
(notice that capdoes not has a right subtree):
Find the path from the node
sac
to its successor
(notice that sacdoes not has a right subtree):
Can you figure out what to do to find the successor node for a node p ???
You will now write an algorithm to do this.
Download the program files given below and
write the
succ(BSTEntry p)
method in Java that
returns the successor node of p.
The succ(BSTEntry p)
will return null if p does not have
a successor.