Question: Use Java plz Problem Description It is the same problem as in Exercise1, but you have to write a different program with O(N) complexity, Where

Use Java plz

 Use Java plz Problem Description It is the same problem asin Exercise1, but you have to write a different program with O(N)

Problem Description It is the same problem as in Exercise1, but you have to write a different program with O(N) complexity, Where N is number of elements in the list from input file. We are given an input file that contains - word SumOfK, - "target" number K, - and a sequence of N numbers. We want to determine if there are two numbers whose sum equals the given "target" number K. For instance, if the input file contains We know from the file that K is 10 , sequence of numbers is 8416 , and number of elements N is 4 (we can count numbers). In this case, the answer is yes, there are two such numbers ( 4 and 6 ), because 4+6 is 10. One number may be used twice (doubled). If the input file is SumOfK 10 8453 the answer is also yes, because 5+5 is 10 . Lab1 Program Devise and implement 1). an O(Nlog(N)) algorithm to sort numbers. For Example https://en.wikipedia.org/wiki/Heapsort 2). the O(N) search for numbers in O(N), see Lab1Clarification.pdf file. Code the solution. Read data from input file in X.txt and print the results to output file out X.txt (where X is 1,2, ) Input and Output Files Test and Sample Files There are five test input files provided - in1.txt, in2.txt, in3.txt, in4.txt and in5.txt. There are also four sample output files corresponding to the input files - out1_sample.txt, out2_sample.txt , out3_sample.txt and out4_sample.txt (file out5_sample.txt is not provided). The format of the produced output files shall be similar to the provided sample output files. The results have to be the same. Run your program using all five test input files to produce five output files and submit the input and output files together with the source code. Compare the output files produced by your program with the sample files. Submit the test input and the produced output files together with the program source code

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!