Imagine that you wrote a program and measured its execution time as a function o
ID: 3883416 • Letter: I
Question
Imagine that you wrote a program and measured its execution time as a function of N. The results of your execution are shown in the table below. You can assume that the program's running time follows a power law T(N) ~ a middot N^b. We have packaged the four algorithms TwoSumFast, TwoSum, ThreeSumFast and ThreeSum 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, TwoSum, ThreeSumFast and ThreeSum 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. Please answer if the time it would take for each algorithms (TwoSumFast, TwoSum, ThreeSumFast and ThreeSum) to solve the problems for a file of 1048576 numbers: a) Milliseconds or seconds b) Minutes or hours c) Hours or days d) Months e) Years And please write an explanation of at least 50 words to why each algorithm takes what time.Explanation / Answer
for 2 sum
N time in seconds
64 0.0
128 0.002
256 0.004
512 0.005
1024 0.015
2048 0.014
4096 0.016
8192 0.037
16384 0.213
32768 0.935
65536 3.82
131072 15.292
262144 61.775
for 2 sum you can clearly see it will take b)minutes or hours
for 2sumfast
N time in seconds
64 0
128 0
256 0
512 0
1024 0
2048 0.0
4096 0
8192 0.016
16384 0.027
32768 0.03
65536 0.064
it will take a)milliseconds or seconds
for 3 sum
N time in seconds
64 0.016
128 0.016
256 0.017
512 0.047
1024 0.048
2048 2.671
4096 21.727
8192 172.65
for 3 sum you can clearly see it will take b) Hours or days
for 3 sumfast
N time in seconds
64 0.0
128 0.0
256 0.0
512 0.016
1024 0.024
2048 0.116
4096 0.43
8192 1.603
16384 6.296
32768 30
65536 125.921
for 3 sumfast you can clearly see it will take b) minutes or hours