Do a complexity analysis on each of the loops below and determine its complexity class. Confirm...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Do a complexity analysis on each of the loops below and determine its complexity class. Confirm your results using empirical analysis where necessary. (1) Sum = 0; for(i=0; i < N; i++ ) (2) Sum = 0; Sum++; for(i=0; i < N; i++) for(j = 0; j < N; j++) (3) Sum = 0; Sum++; for(i=0; i < N; i++ ) for(j=0; j < N * N; j++) Sum++; (4) Sum = 0; for(i=0; i < N; i++ ) for( j = 0; j < 1; j++) Sum++; (5) Sum = 0; for(i=0; i < N; i++ ) for(j = 0; j < i * i; j++) for(k = 0; k < j; k++ ) Sum++; (6) Sum = 0; for(i = 1; i < N; i++ ) for(j=1; j < i * i; j++) if( j % i == 0) for(k = 0; k < j; k++ ) Sum++; Turn in a written report showing the analysis of each algorithm and, where necessary, a table of results for various values of N (at least five) showing the correctness of your analysis. The report should be no more than one page in length. Example: Do a complexity analysis on each of the loops below and determine its complexity class. Confirm your results using empirical analysis where necessary. (1) Sum = 0; for(i=0; i < N; i++ ) (2) Sum = 0; Sum++; for(i=0; i < N; i++) for(j = 0; j < N; j++) (3) Sum = 0; Sum++; for(i=0; i < N; i++ ) for(j=0; j < N * N; j++) Sum++; (4) Sum = 0; for(i=0; i < N; i++ ) for( j = 0; j < 1; j++) Sum++; (5) Sum = 0; for(i=0; i < N; i++ ) for(j = 0; j < i * i; j++) for(k = 0; k < j; k++ ) Sum++; (6) Sum = 0; for(i = 1; i < N; i++ ) for(j=1; j < i * i; j++) if( j % i == 0) for(k = 0; k < j; k++ ) Sum++; Turn in a written report showing the analysis of each algorithm and, where necessary, a table of results for various values of N (at least five) showing the correctness of your analysis. The report should be no more than one page in length. Example:
Expert Answer:
Related Book For
Applied Regression Analysis and Other Multivariable Methods
ISBN: 978-1285051086
5th edition
Authors: David G. Kleinbaum, Lawrence L. Kupper, Azhar Nizam, Eli S. Rosenberg
Posted Date:
Students also viewed these programming questions
-
I need assistance with the question "The Case of the 1901 Pharmacy Chain in Egypt for Marketing Management." . Please give all possible reasons for the collapse of the 19011 chain of pharmacies /...
-
B . A smartphone manufacturer is facing stiff competition from new entrants offering cheaper alternatives. Using the principles of monopolistic competition, analyze how the manufacturer can...
-
Q1. You have identified a market opportunity for home media players that would cater for older members of the population. Many older people have difficulty in understanding the operating principles...
-
Jake Drewrey has total fixed monthly expenses of $ 1,340 and his gross monthly income is $3,875. What is his debt-to-income ratio? How does his ratio compare to the desired ratio?
-
If you were to incorporate lettering on a sand casting, would you make the letters protrude from the surface or recess into the surface? What if the part were to be made by investment casting?
-
In 2018, domestic investment in Japan was 24.4 percent of GDP, and Japanese national saving was 27.9 percent of GDP. What percentage of GDP was Japanese net foreign investment?
-
Question: The legislature of the state of Kentucky was unhappy with the national auto- mobile emissions standards set by the EPA. It passed a statute setting a different standard. Is it allowed to do...
-
Static versus flexible budget variances Dan Ludwig is the manufacturing production supervisor for Atlantic Lighting Systems. Trying to explain why he did not get the year-end bonus that he had...
-
Expected direct materials purchases in Rees Company are $210000 in the first quarter and $270000 in the second quarter. 40 percent of the purchases are paid in cash as incurred, and the balance ...
-
Court Opinion 4-1 United States V. Yoshida, 303 F.3d 1145 (9th Cir. 2002) Section 1324(a)(1)(A)(iv) makes it a crime to (1) encourage or induce, (2) an alien to come to the United States, (3) while...
-
What are the journal entries of the following: 1 1st Sept Acquired 10,000 common shares of Menuet Inc. for $5/share, plus a $1,000 transaction fee. There is no specific election with respect to the...
-
In a uniform magnetic field, B = -2.0 mT a proton is ejected with the velocity 7-10 m/s 7-10 m/s k. (Take q = 1,6x10-19 C, mass of proton-1, 6210-27 kg, # = 3.14) a) What is the diameter of the helix...
-
Jacobe Company uses the weighted average method in its process costing system. The Assembly Department started the month with 4.000 units in its beginning work in process inventory that were 20%...
-
On November 6, 20X7, Zebra Corporation purchased merchandise from an unaffiliated foreign company for 50,000 units of the foreign company's local currency. On that date, the spot rate was $1.259....
-
Your firm represents Rufus Wayne Cowtipper of West Buford, Kentucky, an Olympic-level weight lifter.Rufus Wayne has been training hard for the quickly approaching summer Olympics (just go with me...
-
what are the extreme scores for the following data set Mean 7.142857143 Median 7 Mode 10 Levels of Variability for Activity Level activity level Standard Deviation 2.75726032 Sample Variance...
-
Question One Suppose that lim cos(x) + k = x 0 X 0. What is the value of k, if it exists? Explain your answer. Question Two Let f be a continuous, twice differentiable function such that lim f(x) = 0...
-
Solve each equation or inequality. |6x8-4 = 0
-
The data shown in the following table were obtained from the 1990 Census. Included is information on 26 randomly selected Metropolitan Statistical Areas (MSAs). Of interest are factors that...
-
Answer the same questions as in parts (a) and (b) of Problem 1 for each of the regressions of Y on X in Problems 5 through 8 and Problem 10 of Chapter 5. The following results will be helpful:...
-
Assume that Z is a normal random variable with mean 0 and variance I. a. P (Z 1) = ? b. P (Z ?) = .20
-
\(7 \sqrt{5}+6 \sqrt{14}\) Perform the arithmetic operations without a calculator, if possible. If it is not possible, state why.
-
\(7.3 \sqrt{45}-6.8 \sqrt{20}\) Perform the arithmetic operations without a calculator, if possible. If it is not possible, state why.
-
\(19.8 \sqrt{12}-6.1 \sqrt{3}\) Perform the arithmetic operations without a calculator, if possible. If it is not possible, state why.
Study smarter with the SolutionInn App