subject

Problem Description It is the same problem as in Exercise1, but you have to write a different program. 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
//word SumOfK II
"target" number K I/
sequence of N numbers 10 8416
We know from the file that K is 10, sequence of numbers is 8 4 16, 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 an O(N log(N)) algorithm to solve the problem. Split it in two parts-sort the items first, after it is done, you have to search for numbers in O(N). See https://en. wikipedia. org/wiki/Heapsort Code the solution. Read data from input file inX. txt and print the results to output file outx. txt (where X is 1, 2,.. The differences between Lab1 and Exercise1 are
1. The algorithm has to consist of two parts-O(N"log(N)) sorting and O(N) searching
2. The output file has also to contain the sorted list of input numbers

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 05:30
Agood flowchart alludes to both the inputs and outputs you will need to receive and give to the user. true or false?
Answers: 3
question
Computers and Technology, 22.06.2019 10:30
Choose the best explanation for the following statement communication is symbolic
Answers: 3
question
Computers and Technology, 22.06.2019 22:40
In this lab, you complete a python program that calculates an employee's annual bonus. input is an employee's first name, last name, salary, and numeric performance rating. if the rating is 1, 2, or 3, the bonus rate used is .25, .15, or .1 respectively. if the rating is 4 or higher, the rate is 0. the employee bonus is calculated by multiplying the bonus rate by the annual salary.
Answers: 1
question
Computers and Technology, 23.06.2019 03:00
Your business be in google top rank.more the rank more the business leads.for best seo and digital marketing services be confident to contact you can get best seo solutions by assistance experts provide digital marketing, website development, seo expert services and social media internet seo expert services your branding solutions. seo expert services ,best seo expert services,online seo expert services,
Answers: 3
You know the right answer?
Problem Description It is the same problem as in Exercise1, but you have to write a different progr...
Questions
question
Mathematics, 11.01.2021 21:10
question
Mathematics, 11.01.2021 21:10
Questions on the website: 13722367