CSC 1351 Chapter : 1351 Practice 2
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: