Question: 3. a) Describe an algorithm Join (TA,TB,hA,hB) which merges two AVL trees TA and TB whose initial heights hA and hB are given. You may

 3. a) Describe an algorithm Join (TA,TB,hA,hB) which merges two AVL

3. a) Describe an algorithm Join (TA,TB,hA,hB) which merges two AVL trees TA and TB whose initial heights hA and hB are given. You may assume that: (i) Every key in A is less than every key in B. (ii) hA and hB differ by at most one. Your algorithm must run in time O(hA+hB). Justify that your algorithm produces a valid AVL tree and that it runs in the specified runtime. Erratum: The nodes in TA and TB are labeled with heights, not balance factors. b) Describe an algorithm Join2 2TA,TB,hA,hB) as in part a), except that assumption (ii) is replaced by the following: (iii) hA

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!