×
Log in to StudySoup
Get Full Access to Math - Textbook Survival Guide
Join StudySoup for FREE
Get Full Access to Math - Textbook Survival Guide

Consider the following algorithm, which takes as input a

Discrete Mathematics and Its Applications | 7th Edition | ISBN: 9780073383095 | Authors: Kenneth Rosen ISBN: 9780073383095 37

Solution for problem 12E Chapter 3.3

Discrete Mathematics and Its Applications | 7th Edition

  • Textbook Solutions
  • 2901 Step-by-step solutions solved by professors and subject experts
  • Get 24/7 help from StudySoup virtual teaching assistants
Discrete Mathematics and Its Applications | 7th Edition | ISBN: 9780073383095 | Authors: Kenneth Rosen

Discrete Mathematics and Its Applications | 7th Edition

4 5 1 392 Reviews
12
2
Problem 12E

Consider the following algorithm, which takes as input a sequence of n integers a1, a2, …, an and produces as output a matrix M = {mij} where mij is the minimum term in the sequence of integers ai, ai+1, …, ai for j ≥ i and mij = 0 otherwise.

initialize M so that mij = a, if j ≥ i and mij = 0 otherwise

for i := 1 to n

for j := i + 1 to n

for k := i + 1 to j

mij := min(mij, ak)

return M = {mij}{mij is the minimum term of ai, ai+1, …, aj}

a)     Show that this algorithm uses O(n3) comparisons to compute the matrix M.

b)    Show that this algorithm uses Ω(n3) comparisons to compute the matrix M. Using this fact and part (a), conclude that the algorithms uses ⊝(n3) comparisons. [Hint: Only consider the cases where i ≤ n/4 and j ≥ 3n/4 in the two outer loops in the algorithm.]

Step-by-Step Solution:

Step 1</p>

In this problem we need to show that the given algorithm uses  comparisons to compute the matrix M.

Step 2 of 2

Chapter 3.3, Problem 12E is Solved
Textbook: Discrete Mathematics and Its Applications
Edition: 7
Author: Kenneth Rosen
ISBN: 9780073383095

Unlock Textbook Solution

Enter your email below to unlock your verified solution to:

Consider the following algorithm, which takes as input a

×
Log in to StudySoup
Get Full Access to Math - Textbook Survival Guide
Join StudySoup for FREE
Get Full Access to Math - Textbook Survival Guide
×
Reset your password