Question: Difference between two sets in JAVA. Given two arrays a[] and b[], each containing distinct values, design a subquadratic algorithm to count the number of
Difference between two sets in JAVA.
Given two arrays a[] and b[], each containing distinct values, design a subquadratic algorithm to count the number of values that are contained either in array a[] and array b[] but not both. Create test program DiffSets.java that takes three commandline arguments
For ex: java DiffSets 10 20 100
The program must do the following
1. Create arrays a and b of the mentioned size and fill it with uniformly random numbers between (0-max(size_a, size_b)) <- in this case this would be 0-20
2. Find the numbers that are only present in a or b but not both.
3. Repeat 1 and 2 for n iterations
Run your program for various sizes of a and b (run each 100 times). Observe the running time of your algorithm (either using java's in-built timers or by using the system time). Tabulate your results in the README file.
(Writeup only): How would you extend this algorithm to find unique values in k lists. Can you still maintain the same running time?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
