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 23:30
Select all that apply. which of the following are proofreading options included in microsoft word? spell check find replace grammar check formatting check
Answers: 1
question
Computers and Technology, 24.06.2019 13:00
If you add the following to the query grid in an access query, what is it called? salestaxamt: [salestaxrate]*[totalsale] formula calculated field total calculation
Answers: 2
question
Computers and Technology, 24.06.2019 16:00
What is a dashed line showing where a worksheet will be divided between pages when it prints? a freeze pane a split box a page break a print title
Answers: 1
question
Computers and Technology, 24.06.2019 17:50
Which of the following best describe how the depth-limited search works. a normal depth-first search is performed but the number of ply/depths is limited. a normal breadth-first search is performed but the number of ply/depths is limited. a normal breadth-first search is performed but values above a specific value will be ignored. a normal depth-first search is performed but values above a specific value will be ignored.
Answers: 1
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, 04.09.2020 19:01
question
Biology, 04.09.2020 19:01
Questions on the website: 13722367