   Chapter 9.3, 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
2 views

# a. Consider the following algorithm segment: for i : = 1 to 4 for j : = 1 to i [Statements in body of inner loop. None contain branching statements that lead outside the loop.] next j Next i How many times will the inner loop be iterated when the algorithm is implemented and run? b. Let n be a positive integer, and consider the following algorithm segment: for i : = 1 to n for j : = 1 to i[Statements in body of inner loop. None contain branching statements that lead outside the loop.] next j next i How many times will the inner loop be iterated when the algorithm is implemented and run?

To determine

(a)

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

Explanation

Given information:

fori:=1to4forj:=1toi

[Statements in body of inner loop.None contain branching statements that lead outside the loop.]nextj

Concept used:

The values of i varies from 1to 4.

The values of j varies from 1to i.

Calculation:

The values of i varies from 1to 4.

The values of j varies from 1to i.

If i=1 then j will take only one value, that is 1

To determine

(b)

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

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