   Chapter 9.2, Problem 27ES ### 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 :=5   to   50 for   j : = 10   to   20 [ 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:

Consider the algorithm below:

for i:=5to 50for j:=10to 20

......

next 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:

It is given that i=5to 50

The number of integers from 5to 50 is 505+1=46.

The number of integers from 10to 20 is 2010+1=11.

The outer loop is iterated 46 times and during each iteration of the outer loop, there are 11 iterations of the inner loop.

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

46×11=506

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