For each of the algorithm segments in 6—19, assume that n is a positive integer. (a) Compute the actual number of elementary operations (additions, subtractions, multiplications, divisions, and comparisons) that are performed when the algorithm segment is executed. For simplicity, however, count only comparisons that occur within if then statements; ignore those implied by for-next loops. (b) Use the theorem on polynomial orders to find an order for the algorithm segment.
15. for
Want to see the full answer?
Check out a sample textbook solutionChapter 11 Solutions
Discrete Mathematics With Applications
- Determine which characteristics of an algorithm the following procedures have and which they lack. procedure sum(n: positive integer) sum:= 0 while i<10 sum:= sum + iarrow_forward(2) Let a = 218 and b =-115. Use the Euclidean Algorithm to find the gcd(a,b) and integers m and n such that gcd(a,b)=ma+nb .arrow_forwardGiven f(x)= -x +2x$ -3x + x? -4x + 5. Use Horner's algorithm to compute a. f(-2) b. f(x)/(x+2) C. How many multiplications was involved at part (a)arrow_forward
- Find the fifth term in the expansion of (x2 + y2)10arrow_forwardUse R X <- c(1.0, 6.4, NA, 16.5, 90.9, 0.1, 0.6, NA, 11.5, NA)X using EM Algorithm, impute the missing values, use while loop and find the number of iterations and the difference between old value and new valuearrow_forwardUse the inversion algorithm to find the inverse of A = 1 2 3 0 1 2 011arrow_forward
- Algebra & Trigonometry with Analytic GeometryAlgebraISBN:9781133382119Author:SwokowskiPublisher:Cengage