Question: Sally has sent you a record of the order in which she INSERT - ed friends into her BST . ( Note that in
Sally has sent you a record of the order in which she INSERTed friends into her BSTNote that in this case, Hananah
starts out being the best friend, as she is added first. The best friend will not necessarily be the same person throughout
the lifetime of the BST
Name Birthday
Hannah August
Georgie July
Dani April
Callum March
Feroz June
Abby January
Ben February
Ethan May
Draw a diagram of Sally's current BST and compile a list of the sequence of ROTATE emails Sally would need to
send in order to reorganise the BST so that subsequent SEARCH times are minimised. You dont need to include the
full text of the emails, but your list should indicate who to send the email to which friend needs to be changed, and
which form of ROTATE to use. Include intermediate diagrams showing the effect of each rotation on the BST Note
that it may be necessary for Sally herself to change her best friend using a ROTATE.
Further Explanation: These operations correspond to the standard rotate operations that are defined for a binary
search tree. For this question and also the next one, you are asked to create diagrams to illustrate what happens as the
tree is rotated. These diagrams do not need to be created with software; imagesphotos of neat handdrawn diagrams
are fine.
You should draw the initial state of the BST after all of the friends have been added, in the order shown above. Next,
you should provide a diagram to show the effect of every rotation applied in order to balance the tree. For this question,
you should finish with a balanced tree that provides optimal efficiency for inserting and searching ie not using the
AVL definition of a balanced tree, which will be used in question
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
