   Chapter 9.6, Problem 8ES ### 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

# In 8 and 9, how many times will the innermost loop be iterated when the algorithm segment is implemented and run? Assume n, m, k, and j are positive integers. 8. for m :   = 1 to n for k :   = 1 to m for j :   = 1 to kfor i :   = 1 to j [Statements in the body of the inner loop, none containing branching statements that lead outside loop] next i next j next k next m

To determine

To find the number of times that the innermost loop be iterated when the algorithm segment is implemented and run. Assume n,m,k and j are positive integers.

for m:=1to nfork:=1 to mfor j:=1 to kfor i:=1 to j[Statement in the body of the inner loop, none containing branching statements that lead outside the loop]nextinextjnext knext m

Explanation

Given information:

Construct a trace table for the values of m,k,j and i for which the statement in the body of the inner most loop are executed.

Concept used:

Observe that i goes from 1 to j. It is always the case that ij. Similarly, because j goes from 1 to k, it is always the case that jk and similarly km.

Observe that there is one iteration of the inner most loop for each column and there is one column of the table for each quadruples of integers (i,j,k,m) with 1ijkmn.

Calculation:

The total number of quadruples is same as 4 combinations with repetition allowed that can be formed from a set of n elements

### 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 