Question: 1 . Consider the following array: A = [ 1 0 , 3 , 4 , 2 , 7 , 1 4 , 8 ,

1. Consider the following array:
A =[10,3,4,2,7,14,8,6,9].
(i) Let A be the sorted array from part (a). Trace the binary search
algorithm for the keys k1=12 and k2=4 in A
, separately. Determine the number of comparisons in each search.
(ii) Suppose a binary search tree T for n keys is given. What indicates
whether T is balanced?
(iii) Determine the efficiency class of the time complexity of the binary
search tree algorithm in the worst-case for each of the following
key sets K1 and K2 of each size n:
a. The binary search tree constructed for K1 is balanced.
b. The binary search tree constructed for K2 has height n 1.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!