   Chapter 9.6, Problem 9ES ### 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 positive integers. for   k : = 1   to  n

To determine

To find the number of times that 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 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 j to n. It is always the case that ij. Similarly, because j goes from k to n, it is always the case that jk.

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

Calculation:

The total number of triples is same as 3 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 