Answered Essay: We have packaged the four algorithms TwoSumFast and TwoSum, in a jar file that you can download from (https: //github.com/idl

We have packaged the four algorithms TwoSumFast and TwoSum, in a jar file that you can download from (https://github.com/id1020/lab2-runningtimes/blob/master/runningtimes. jar? raw=true). Also, a simple program has been added to measure the execution time of each of the algorithms for some given input, For example, if you want to measure the time taken by TwoSum for a file of 1000 numbers, you should run > java -jar runningtimes.jar 2sum 1000 1000 0.006 The program prints back the input size which is 1000 and the time taken which is 0.006 seconds. Question: Estimate the amount of time it would take to run TwoSumFast and TwoSum, on your computer to solve the problems for a file of 1048576 numbers. Notice that measuring the execution time is not feasible for all points, so you have to think about predicting time for those point you cant measure. Answer with at least 50 words to explain which of the alternatives are correct: a) miliseconds or seconds b) minutes or hours c) hours or days d) days or months e) years

We have packaged the four algorithms TwoSumFast and TwoSum, in a jar file that you can download from (https: //github.com/idl020/lab2-runningtimes/blob/master/runningtimes.jar? raw=true). Also, a simple program has been added to measure the execution |time of each of the algorithms for some given input. For example, if you want to measure the time taken by TwoSum for a file of 1000 numbers, you should run > java -jar runningtimes.jar 2sum 1000 1000 0.006 The program prints back the input size which is 1000 and the time taken which is 0.006 seconds. Estimate the amount of time it would take to run TwoSumFast and TwoSum, on your computer to solve the problems for a file of 1048576 numbers. Notice that measuring the execution time is not feasible for all points, so you have to think about predicting time for those point you can’t measure. Answer with at least 50 words to explain which of the alternatives are correct: a) miliseconds or seconds b) minutes or hours c) hours or days d) days or months e) years

Expert Answer

 

Two sum

The 2sum algorithm was checked with running a sum of variable number of elements and 5 observations were recorded.

1st Run on total 1,000 elements — time taken to complete the process – 0.013 seconds

2nd Run on total 5,000 elements — time taken to complete the process –0.025 seconds

3rd Run on total 10,000 elements — time taken to complete the process –0.126 seconds

4th Run on total 15,000 elements — time taken to complete the process –0.236 seconds

5th Run on total 20,000 elements — time taken to complete the process –0.453 seconds

Now, studying the pattern it was found

0.025 = 1.92 x 0.013

0.126 = 9.69 x 0.013

0.236 = 18.15 x 0.013

0.453 = 34.84 x 0.013

Hence studying the above pattern the time can be calculated as approximately

=> 2n+1 0.013 —————————–where n = total elements / 5000

Hence calculating for 1,048,576 elements

n = 1048576 / 5000 = 209.71 = 210 approx

Putting the value of n in in the formula we get,

( 2( 210 + 1 ) ) . ( 0.013 )

( 2211 ) . ( 0.013 )

4.2783 x 10^61 seconds

Changing into hours

1.1884 x 10^58 hours

Now changing hours to days we get

4.9517 x 10^56 days

Now changing days to years

1.3566 x 10^54 years to complete.

Hence it would take years to complete the summation using the algorithm 2sum.

2sumfast

This algorithm’s time is not increasing exponentially, rather it’s increasing by a fraction of 10. On running this algorithm for few observations it was found it took less than a second to sum the 10,000,000 elements.

Look at the findings below.

C:UsersUserDesktop>java -jar runningtimes.jar 2sumfast 1000
1000 0.007

C:UsersUserDesktop>java -jar runningtimes.jar 2sumfast 5000
5000 0.013

C:UsersUserDesktop>java -jar runningtimes.jar 2sumfast 10000
10000 0.022

C:UsersUserDesktop>java -jar runningtimes.jar 2sumfast 15000
15000 0.03

C:UsersUserDesktop>java -jar runningtimes.jar 2sumfast 20000
20000 0.034

C:UsersUserDesktop>java -jar runningtimes.jar 2sumfast 100000
100000 0.089

C:UsersUserDesktop>java -jar runningtimes.jar 2sumfast 1000000
1000000 0.353

C:UsersUserDesktop>java -jar runningtimes.jar 2sumfast 1048576
1048576 0.395

C:UsersUserDesktop>

Buy Essay
Calculate your paper price
Pages (550 words)
Approximate price: -

Help Me Write My Essay - Reasons:

Best Online Essay Writing Service

We strive to give our customers the best online essay writing experience. We Make sure essays are submitted on time and all the instructions are followed.

Our Writers are Experienced and Professional

Our essay writing service is founded on professional writers who are on stand by to help you any time.

Free Revision Fo all Essays

Sometimes you may require our writers to add on a point to make your essay as customised as possible, we will give you unlimited times to do this. And we will do it for free.

Timely Essay(s)

We understand the frustrations that comes with late essays and our writers are extra careful to not violate this term. Our support team is always engauging our writers to help you have your essay ahead of time.

Customised Essays &100% Confidential

Our Online writing Service has zero torelance for plagiarised papers. We have plagiarism checking tool that generate plagiarism reports just to make sure you are satisfied.

24/7 Customer Support

Our agents are ready to help you around the clock. Please feel free to reach out and enquire about anything.

Try it now!

Calculate the price of your order

Total price:
$0.00

How it works?

Follow these simple steps to get your paper done

Place your order

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.

HOW OUR ONLINE ESSAY WRITING SERVICE WORKS

Let us write that nagging essay.

STEP 1

Submit Your Essay/Homework Instructions

By clicking on the "PLACE ORDER" button, tell us your requires. Be precise for an accurate customised essay. You may also upload any reading materials where applicable.

STEP 2

Pick A & Writer

Our ordering form will provide you with a list of writers and their feedbacks. At step 2, its time select a writer. Our online agents are on stand by to help you just in case.

STEP 3

Editing (OUR PART)

At this stage, our editor will go through your essay and make sure your writer did meet all the instructions.

STEP 4

Receive your Paper

After Editing, your paper will be sent to you via email.