Question: Give an efficient algorithm to compute the union of sets A and B , where n = max( |A|, |B| ). The output should be
Give an efficient algorithm to compute the union of sets A and B, where n = max(|A|, |B|). The output should be an array of distinct elements that form the union of the sets, such that they appear exactly once in the union. Assume that A and B are unsorted. Give an O(n log n) time algorithm for the problem.
Step by Step Solution
There are 3 Steps involved in it
To compute the union of two sets A and B where each element appears exactly once in the resulting un... View full answer
Get step-by-step solutions from verified subject matter experts
