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 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
Get step-by-step solutions from verified subject matter experts
