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 13:00
Why the bear has a slunky tail determine the meaning of the word slunk in the story
Answers: 1
question
Computers and Technology, 22.06.2019 16:20
It policy compliance and emerging technologies respond to the following: propose at least three control measures that organizations need to put in place to ensure that they remain complaint with emerging technologies and in a continually changing it environment. examine the correlation of effective configuration management and change control procedures to remain compliant with emerging technologies and it security changes.
Answers: 2
question
Computers and Technology, 23.06.2019 18:00
Freya realizes she does not have enough in her bank account to use the debit card. she decides to use a credit card instead. which questions should freya answer before using a credit card? check all that apply. can i pay at least the minimum payment each month? can i make payments on time and avoid late fees? will i have to take out a loan? how much in finance charges can i afford to pay? should i talk to a consumer credit counseling service?
Answers: 1
question
Computers and Technology, 24.06.2019 01:30
Suppose a cpu with a write-through, write-allocate cache achieves a cpi of 2. what are the read and write bandwidths (measured by bytes per cycle) between ram and the cache? (assume each miss generates a request for one block.)
Answers: 1
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, 02.02.2021 17:20
question
History, 02.02.2021 17:20
question
Mathematics, 02.02.2021 17:20
question
Biology, 02.02.2021 17:20
question
Mathematics, 02.02.2021 17:20
Questions on the website: 13722359