Answered step by step
Verified Expert Solution
Question
1 Approved Answer
A = [ KHYRO , REIVA , FLINN , DARIA , FLINT , MYIAH , MILENA , DARIN , MILES , KHYRA ] B =
A = [ KHYRO , REIVA , FLINN , DARIA , FLINT , MYIAH , MILENA , DARIN , MILES , KHYRA ]
B = [ A [ U[ i ]] for i in range (10) ]
U = [4,2,0,5,1,8,3,6,7,9]
a) Draw the binary search tree we obtain if we start from the empty tree and add consecutively the elements of the array B calculated above, i.e. starting from B[0] and going to B[9]. Explain step-by-step how the last element (B[9]) is inserted in the tree.
(b) Enumerate the elements of the tree you constructed in part (a) using (left-first) depth-first search (and pre-order).
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