   Chapter 9.2, Problem 26ES ### 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 each of 24-28, determine how many times innermost loop will be iterated when thw algorithm sefrnent is implemented and run. (Assume that m , n , p , a , b , c and d are all positive integers.) for   j :=1   to   m for k : = 1   to   n for     k : = 1   to   p [ S t a t e m e n t   i n b o d y   o f   i n n e r l o o p . N o n e   c o n t a i n   b r a n c h i n g   s t a t e m e n t s   t h a t l e a d   o u t s i d e   t h e   l o o p . ] next   k next   j

To determine

To find how many times the innermost loop will be iterated when the algorithm segment is implemented and run.

Explanation

Given information:

Algorithm segment is implemented and run.

Concept used:

Assume that m, nand p are positive integers.

Consider the algorithm below:

for i:=1to mfor j :=1to nfor k:=1to p

.....

next knext jnext i

The objective is to determine the number of times the innermost loop will be iterated when the algorithm segment is implemented and run.

Calculation:

The outer loop is iterated m times and at each of the iteration of the outer loop, there are n iterations of the inner loop.

For each of the iteration of the inner loop, there are p iterations of the innermost loop.

Thus, by the rule of multiplication, the total number of iterations of the innermost loop is,

m×n×p=mnp

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