You are on page 1of 2
23 Mathematical Analysis of Nonrecursive Algorithms 67 Exercises 2.3 1. Compute the following sums. a 1+3454+74+---+999 b. 24+44+8+16+ +1024 ert a Do e Di +) ££ eg DL b DLviG+y 2. Find the order of growth of the following sums. Use the @(g(n)) notation with the simplest function g(n) possible. a DI ba. DIP le? e D+ be a. YI Lich +) 3. The sample variance of n measurements xj, .. ., x, can be computed as either ” Gy, — =)? eo TiO" here g = Liat 1 n or Dh? = Cha /n nl Find and compare the number of divisions, multiplications, and additions! subtractions (additions and subtractions are usually bunched together) that are required for computing the variance according to each of these formulas. 4, Consider the following algorithm. ALGORITHM Mystery(n) /Input: A nonnegative integer n s<0 fori <1tondo S maxval maxval < Ali] return maxval — minval Answer questions (a)-(e) of Problem 4 about this algorithm, 6. Consider the following algorithm. ALGORITHM Enigma(A[0..n — 1, 0.n —1)) Minput: A matrix A[0..n ~ 1, 0..n ~ 1] of real numbers fori —0ton—2do for j

You might also like