subject

For each of the following six program fragments: a. give an analysis of the running time (big-oh will do).b. implement the code in the language of your choice, and give the running timefor several values of n. c. compare your analysis with the actual running times.(1) sum = 0; for( i = 0; i < n; ++i )++sum; (2) sum = 0; for( i = 0; i < n; ++i )for( j = 0; j < n; ++j )++sum; (3) sum = 0; 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 < i; ++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;

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 10:30
Aconstruction company is creating a powerpoint presentation describing how they calculate costs during each construction step. they plan to email this presentation to clients. the individual clients will be watching the presentation slide show on their own personal computers. what is the most important formatting step the company should take to make the text readable and pleasing to the eye?
Answers: 2
question
Computers and Technology, 22.06.2019 22:00
Researchers measured the data speeds for a particular smartphone carrier at 50 airports. the highest speed measured was 78.1 mbps. the complete list of 50 data speeds has a mean of x overbarequals16.11 mbps and a standard deviation of sequals18.65 mbps. a. what is the difference between carrier's highest data speed and the mean of all 50 data speeds? b. how many standard deviations is that [the difference found in part (a)]? c. convert the carrier's highest data speed to a z score. d. if we consider data speeds that convert to z scores between minus2 and 2 to be neither significantly low nor significantly high, is the carrier's highest data speed significant? a. the difference is nothing mbps.
Answers: 3
question
Computers and Technology, 23.06.2019 01:20
Write a function balancechemical to balance chemical reactions by solving a linear set of equations. the inputs arguments are: reagents: symbols of reagents in string row array products: symbols of products in string row array elements: elements in the reaction in string row array elcmpreag: elemental composition of reactants in two dimensional numeric array elcmpprdcts: elemental composition of prducts in two dimensional numeric array hint: the first part of the problem is setting up the set of linear equations that should be solve. the second part of the problem is to find the integers from the solution. one way to do this is to mulitiply the rational basis for the nullspace by increasing larger integers until both the left-and right-side integers exist. for example, for the reaction that involves reacting with to produce and : reagents=["ch4", "o2"]; products =["co2", "h2o"]; elements =["c","h", "o"] elcmpreag=[1,4,0;
Answers: 3
question
Computers and Technology, 23.06.2019 20:00
Me ajude por favor , coloquei uma senha e não consigo tira-la no chorme
Answers: 2
You know the right answer?
For each of the following six program fragments: a. give an analysis of the running time (big-oh wil...
Questions
question
Mathematics, 02.08.2019 09:00
question
Biology, 02.08.2019 09:00
question
Mathematics, 02.08.2019 09:00
Questions on the website: 13722367