Question: Let A [ 1 , dots, m ] and B [ 1 , dots, n ] be two sorted arrays each containing distinct elements. Let
Let dots, and dots, be two sorted arrays each containing distinct elements. Let and
is a multiple of The problem is to determine if the two arrays are disjointed or not. Two arrays are
said to be disjointed if their intersection is
Let us assume that A and are disjoint. We define as the sorted combination of A and ie
and is sorted. Clearly, because Define of length
where if and otherwise. Give a count of the number of such possible arrays
Justify your answer.
Solution: INSERT YOUR SOLUTION HERE
We go back to the original problem we do not know whether are disjoint. Let us assume that
A contains element, and contains elements.
Draw a comparisonbased decision tree for this problem.
You will also present a modification of the above tree where you will change the label of every
leaf node marked as true with a corresponding array
You will ensure that your decision tree makes the least number of comparisons possible and has the
shortest height possible. The internal node will be of the form which indicates that you are
comparing and Now, each such internal node will have three children one corresponding
to one corresponding and one corresponding The leaf
nodes will contain the values true, false where true indicates that are disjoint and false
indicates the opposite.
Solution: INSERT YOUR SOLUTION HERE
Now look the general problem, for any can shown you will give a proof
part for extra credit that the decision tree for this general problem will have every leaf node
labeled true correspond with a distinct array defined part This fact a bijective
mapping, every leaf node labeled true has a corresponding array and every array has
a corresponding leaf node labeled true Now, using this and your answer from part show that
problem has a worstcase lower bound : Use:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
