Question: Write a program to read a list of integers from a file, datax, and a value, sumVal, and reports if there is in dataX four

Write a program to read a list of integers from a file, datax, and a value, sumVal, and reports if there is in dataX four distinct integers that add up to sumVal. If so, it reports the value of the integers in the quartet. The algorithm should run in On") time. For instance, if file dataX has the integers (3,-2,2,5,2,-6,1) and value sumVal is 2 then the output should be (-6, 1, 5, 2). But the program should disregard the any quadruplet that has a repeated entry. The whole program should run in ET(n) = (n) where n is the number of integers in the file dataX. A simple program that checks each possible quadruplet of pairs in the range with three nested loops) would run in O(n") time, so you will need to use hash table with the sum of pairs to answer the question faster than that. 1. Describe how your algorithm uses a hash table to speed up the search for a quadruplet that satisfies the requirement, and GIVE PSEUDO-CODE for your algorithm. 2. Implement your algorithm in Java, C++, C, Python3 or Scala. You do not need to implement the hashing data structures from scratch (you may use the sets and maps provided by your language of choice). However, you may not use the OSU java components used in Software I or
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
