Question
Given two lists of n integers A, B and an integer S, where all the elements in each list are unique, write aJAVAprogram using atransform-and-conqueralgorithm
Given two lists ofnintegers A, B and an integer S, where all the elements in each list are unique, write aJAVAprogram using atransform-and-conqueralgorithm with efficiency class(nlogn)to decide whether there is an integer from A and an integer from B such that the sum of these two integers is equal to S.
For example, if A = {8, 3, 4, 7} and B = {5, 6, 12, 1} and S is 10, then your program should output "4 + 6 = 10" (where 4 is from A and 6 is from B).
Another example, if A = {1, 5, 4, 2} and B = {6, 3, 2, 1} and S is 9, then your program should output "No two integers from A and B add up to 9".
The algorithm in the program must be a transform-and-conquer algorithm with efficiency class(nlogn), not (n^2)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started