   # Trace the action of Algorithm 6,1,1 on the variables I, j, found, and answer for m = 4, n = 4, and sets A and B represented as the arrays a [ 1 ] = u , a [ 2 ] = v , a [ 3 ] = w ; b [ 1 ] = w ; b [ 2 ] = u . ### Discrete Mathematics With Applicat...

5th Edition
EPP + 1 other
Publisher: Cengage Learning,
ISBN: 9781337694193

#### Solutions

Chapter
Section ### Discrete Mathematics With Applicat...

5th Edition
EPP + 1 other
Publisher: Cengage Learning,
ISBN: 9781337694193
Chapter 6.1, Problem 37ES
Textbook Problem
1 views

## Trace the action of Algorithm 6,1,1 on the variables I, j, found, and answer for m = 4, n = 4, and sets A and B represented as the arrays a [ 1 ] = u , a [ 2 ] = v , a [ 3 ] = w ; b [ 1 ] = w ; b [ 2 ] = u .

To determine

To trace:

The action of Algorithm 6.1.1 on the variables i, j, found and answer for m = 4,

n = 4.

### Explanation of Solution

Given information:

For m = 4, n = 4 and sets A and B represented as the arrays a=u,a=v,a=w,a=x,b=r,

b=u,b=y,b=z.

Calculation:

Input:

m=4

n=4

a=u

a=v

a=w

a=x

b=r

b=u

b=y

b=z

We also initialize i as 1 and we initialize answer as AB.

 i 1 j found answer A⊆B

Next, the algorithm will enter the outer while-loop.

We first assign the value 1 to j and the value “no” to found.

 i 1 1 j 1 found no answer A⊆B A⊆B

Since, a=ur=b, the value of found is not changed in the first iteration of the inner while-loop.

We increase the value of j by 1.

Since a=u=b, we change the value of found to “yes”.

 i 1 1 1 j 1 2 found no yes answer A⊆B A⊆B A⊆B

Since, found is set to “yes”, the inner while-loop stops executing and we then increase i by 1.

Next, we start the second iteration of the outer while-loop, which re-initializes j as 1 and found as “no”.

 i 1 1 1 2 j 1 2 1 found no yes no answer A⊆B A⊆B A⊆B A⊆B

Since, a=vw=b, the value of found is not changed in the first iteration of the inner while-loop.

We increase the value of j by 1.

Since, a=vr=b, the value remains “no”

 i 1 1 1 2 2 j 1 2 1 2 found no yes no no answer A⊆B A⊆B A⊆B A⊆B A⊆B

We increase the value of j by 1.

Since a=vy=b, the value of found remains “no”

 i 1 1 1 2 2 2 j 1 2 1 2 3 found no yes no no no answer A⊆B A⊆B A⊆B A⊆B A⊆B A⊆B

We increase the value of j by 1.

Since a=vz=b, the value of found remains “no”

 i 1 1 1 2 2 2 2 j 1 2 1 2 3 4 found no yes no no no no answer A⊆B A⊆B A⊆B A⊆B A⊆B A⊆B A⊆B

We increase the value of j by 1.

Since j = 5 > 4 = n, the inner while-loop stops executing.

Since found is still set to “no”, answer is changed to AB.

 i 1 1 1 2 2 2 2 2 j 1 2 1 2 3 4 5 found no yes no no no no no answer A⊆B A⊆B A⊆B A⊆B A⊆B A⊆B A⊆B A⊆B

Next, we increase i by 1. We then start the third iteration of the outer while-loop, which re-initializes j as 1 and found as “no”

 i 3 j 1 found no answer A⊆B

Since a=wr=b, the value of found is not changed in the first iteration of the inner while-loop.

We increase the value of j by 1.

Since a=wu=b, the value of found remains “no”

 i 3 3 j 1 2 found no no answer A⊆B A⊆B

We increase the value of j by 1.

Since a=wy=b, the value of found remains “no”

 i 3 3 3 j 1 2 3 found no no no answer A⊆B A⊆B A⊆B

We increase the value of j by 1.

Since a=wz=b, the value of found remains “no”

 i 3 3 3 3 j 1 2 3 4 found no no no no answer A⊆B A⊆B A⊆B A⊆B

We increase the value of j by 1.

Since j = 5 > 4 = n, the inner while-loop stops executing.

Since found is still set to “no”, answer is set to AB.

 i 3 3 3 3 3 j 1 2 3 4 5 found no no no no no answer A⊆B A⊆B A⊆B A⊆B A⊆B

Next, we increase i by 1

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

Find more solutions based on key concepts
Find the measure of x.

Mathematical Excursions (MindTap Course List)

32. Solve for y.

Mathematical Applications for the Management, Life, and Social Sciences

Eastern Pacific Yellowfin Tuna Studies to fit a logistic model to the Eastern Pacific yellowfin tuna population...

Functions and Change: A Modeling Approach to College Algebra (MindTap Course List)

Find the derivative of the function. f(x)=1x213

Single Variable Calculus: Early Transcendentals, Volume I

In Exercises 914, evaluate the expression. 9. (94)3/2

Applied Calculus for the Managerial, Life, and Social Sciences: A Brief Approach

If f(x) 5 for all x [2, 6] then 26f(x)dx. (Choose the best answer.) a) 4 b) 5 c) 20 d) 30

Study Guide for Stewart's Single Variable Calculus: Early Transcendentals, 8th 