Question: Design an algorithm that given two sets of integers, say A and B, computes the distance between the sets A and B, that is, the
Design an algorithm that given two sets of integers, say A and B, computes the distance between the sets A and B, that is, the minimum absolute value of the difference between an element from one set and an element from another: min{|i j|: j A, j B}. For full credit, your algorithm must run in O(n log n) time.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
