×
Log in to StudySoup
Get Full Access to Discrete Mathematics And Its Applications - 7 Edition - Chapter 3.3 - Problem 12e
Join StudySoup for FREE
Get Full Access to Discrete Mathematics And Its Applications - 7 Edition - Chapter 3.3 - Problem 12e

Already have an account? Login here
×
Reset your password

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 293 Reviews
12
2
Problem 12E

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:

Solution:

Step 1

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

Other solutions

People also purchased

Related chapters

Unlock Textbook Solution

Enter your email below to unlock your verified solution to:

Consider the following algorithm, which takes as input a