   Chapter 11.3, Problem 19ES ### Discrete Mathematics With Applicat...

5th Edition
EPP + 1 other
ISBN: 9781337694193

#### Solutions

Chapter
Section ### Discrete Mathematics With Applicat...

5th Edition
EPP + 1 other
ISBN: 9781337694193
Textbook Problem
1 views

# 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.19. for i : = 1 to nfor j : = 1 to ifor k : = 1 to j x : = i ⋅ j ⋅ k next knext jnext i

To determine

(a)

Compute the actual number of the elementary operation by execution of algorithm.

Explanation

On each iteration of the inner for-loop execute x:=i*j*k exactly once whichmultiplication. Thus in total execute 2 operation per iteration of inner for-loop.

Determine the number of iteration of the inner for-loop. k can goes from 1 to j which are j-1+1=j possible values and j varies from 1 to i and i varies from 1 to n.

No of iteration inner loop=

i=1n j=1 ij=i=1ni(i+1)/2=i=2n(i2

To determine

Use the theorem on polynomial order to find the order for the algorithm segments

### Still sussing out bartleby?

Check out a sample textbook solution.

See a sample solution

#### The Solution to Your Study Problems

Bartleby provides explanations to thousands of textbook problems written by our experts, many with advanced degrees!

Get Started 