Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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. Finds pairs of elements in the hashtable whose sum is another element (sum) in the hashtable and print the pairs in the console Returns another hashtable names "sums" of those sum elements. 1. 2. 3. For example Input: [1,5,4,6,7,9] Output: [6,5,7,9] import java.util.HashSet; public class FindSum f public static void main(String args[]D int[] arr-( 1, 5, 4, 6, 7, 9 ); HashSet findSums (int[] elements)f HashSet(); hashtable.add (newItem) hashtable.contains (item); return sums
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