Question
Questions 1 and 2 are concerned with the RecursionMystery algorithm below. Input: data: sorted array with n elements Input: n: size of data Input: bst:
Questions 1 and 2 are concerned with the RecursionMystery algorithm below.
Input: data: sorted array with n elements
Input: n: size of data
Input: bst: a binary search tree
1 Algorithm: RecursionMystery
2 if n = 1 then
3 bst.Insert(data[1])
4 else if n > 1 then
5 mid = dn/2e
6 bst.Insert(data[mid])
7 RecursionMystery(data[1..mid 1], bst)
8 RecursionMystery(data[mid + 1..n], bst)
9 end
1) What are the bst insertions that would occur when invoking RecursionMystery on the array [13, 19, 33, 40, 40, 63, 92]? Be sure to list your answer in the order in which RecursionMystery would insert the values.
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