Question: Given an array of unique positive integers, write a function findSums that takes the array input and: Creates a hashtable called hashT and inserts all

Given an array of unique positive integers, write a function findSums that takes the array input and: Creates a hashtable called "hashT" and inserts all the elements of the input array in the hashtable. 2. 1. Finds pairs of elements in the hashtable whose sum is another element (sum) in the hashtable and print the pairs in the console. 3. Returns another hashtable names "sums" of those sum elements. For example: Input: [1,5,4,6,7,9] Output: [6,5,7,9] Explanation: 6 1+5 5 1 4; 7 16 9 54 -Class Template -- import java.util.HashSet; public class FindSum t public static void main(String args[]) int] arr - 1, 5, 4, 6, 7, 9 ; HashSet res = findSums (arr); System.out.println(res.toString)); 1/ Should return [6,5,7,9] public static Hashset
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
