Question: Problem 3. Consider non-empty binary search trees T1 and T2 such that all values in T1 are smaller than the values in T2. The SETUNION


Problem 3. Consider non-empty binary search trees T1 and T2 such that all values in T1 are smaller than the values in T2. The SETUNION operation takes binary search trees T1 and T2 and returns a binary search trees holding all values originally in T1 and T2 (destroying T1 and T2 in the process). P3.1. Assume the binary search trees storing T1 and T2 have the same height h. Show how to implement the SETUNION operation in h such that the resulting tree has a height of at-most h+1. P3.2. Assume that T1 and T2 are red-black trees with the same black height h. Show how to implement a SETUNION operation that returns a red-black tree in h. P3.3. Assume that T1 and T2 are red-black trees with black heights h1>h2. Show how to implement a SEtUNion operation that returns a red-black tree in h1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
