CSC 1351 Chapter : 1351 Practice 2

12 views1 pages
15 Mar 2019
School
Course
Professor

Document Summary

You need to go over the previous practice problems also, if needed. How many tests and updates did you save? for (sum=0, i=1; i<=n; i+=2) sum += 2*i + 1; //i + (i+1: clean up the code below (eliminate unnecessary updates and tests in the loop-body). Also, give the number of comparisons you made involving the items in nums-array and the number of exchanges. Show the values of freqs[i][ j] if the successive random integers were 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1 (n = 12 and numitems = 2). Give the code to compute the frequencies freqs[i][ j]. (the values freqs[i][ j] will be more or less the same if n is very large compared to numitems. ) Give the out- put of the following statement:

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents