Introduction To Algorithms, Third Edition (international Edition)
Introduction To Algorithms, Third Edition (international Edition)
3rd Edition
ISBN: 9780262533058
Author: Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, Clifford Stein
Publisher: TRILITERAL
bartleby

Videos

Question
Book Icon
Chapter 15, Problem 8P

(a)

Program Plan Intro

To show the number of possible seams grows exponential.

(a)

Expert Solution
Check Mark

Explanation of Solution

Consider an array A for the compressing the picture so it requires to remove the pixels in the two adjacent rows in the same or adjacent column and the pixels are removed forms a seam from the top row to the bottom row.

Suppose n>1 for the seam algorithm the choice of pixel at any row have at least 2 choices of the pixels to the next row added to the seam.

The total area enclosed by the seams is order of m and it has two choices for every area of m so the total probability of the total number of seams can be varies from 2m to 2m -1.

Hence, the total number of possibilities of seams is bounded by O(2m) so the grow of number of seam will be exponentially.

(b)

Program Plan Intro

To give an algorithm that finds a seam with lowest disruption measure.

(b)

Expert Solution
Check Mark

Explanation of Solution

The algorithm to find a seam with the lowest disruption is given below:

Seam(A)

Initialize tables D[1.....m,1.....n] of zeros and S[1....m,1....n] of empty lists.

For i=1 to n do

  S[1,i]=(1,i).D[1,i]=d1i.

End for.

for i=2 to m do

for j=1 to n do

If j==1 then

If D[i,j]<D[i1,j+1] then

  D[i,j]=D[i1,j]+d.S[i,j]=S[i1,j].insert(i,j).

End if.

Else

  D[i,j]=D[i1,j+1]+d.S[i,j]=S[i1,j+1].insert(i,j).

End if.

Else if( j==n ) then

If() then

  D[i,j]=D[i1,j1]+d.S[i,j]=S[i1,j1].insert(i,j).

End if.

End if.

  x=MIN(D[i1,j1],D[i1,j],D[i1,j+1])

  D[i,j]=D[i1,j+x].S[i,j]=S[i1,j+x].insert(i,j).

End for.

End for.

  q=1.

For j=1 to n do

If D[m,j]<D[m,q] then

  q=j .

End if.

End for.

Print the list S[m,q] .

End.

The algorithm compressing the picture so it requires to removes the pixels in the two adjacent rows in the same or adjacent column and the pixels are removed forms a seam from the top row to the bottom row.

This algorithm takes the array A as input and the cases to insert pixel according to the defined condition and return the list of seam as S[m,q] .

Want to see more full solutions like this?

Subscribe now to access step-by-step solutions to millions of textbook problems written by subject matter experts!
Students have asked these similar questions
When the given integer variable numberOfPackages is: greater than 12, output "Needs more than one box". between 5 inclusive and 12 inclusive, output "Large box". between 0 exclusive and 4 inclusive, output "Small box". less than or equal to 0, output "Invalid input". End with a newline.
summarize in a short paragraph how to Advance Incident Response and Automation in ML home based security systems
1.[30 pts] Computers generate color pictures on a video screen or liquid crystal display by mixing three different colors of light: red, green, and blue. Imagine a simple scheme, with three different lights, each of which can be turned on or off, projecting onto a glass screen: We can create eight different colors based on the absence (0) or presence (1) of light sources R,G and B: R G B Color 0 0 0 Black 0 0 1 Blue 0 1 0 Green 0 1 1 Cyan 1 0 0 Red 1 0 1 Magenta 1 1 1 0 Yellow 1 White 1 Each of these colors can be represented as a bit vector of length 3, and we can apply Boolean operations to them. a. The complement of a color is formed by turning off the lights that are on and turning on the lights that are off. What would be the complement of each of the eight colors listed above? b. Describe the effect of applying Boolean operations on the following colors: Λ 1. Red(100) ^ Magenta(101)= Blue(001) 2. Bue(001) | Green(010)= 3. Yellow(100) & Cyan(011)= 2.[30 pts] Perform the following…
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
New Perspectives on HTML5, CSS3, and JavaScript
Computer Science
ISBN:9781305503922
Author:Patrick M. Carey
Publisher:Cengage Learning
Text book image
Systems Architecture
Computer Science
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Cengage Learning
Text book image
Fundamentals of Information Systems
Computer Science
ISBN:9781305082168
Author:Ralph Stair, George Reynolds
Publisher:Cengage Learning
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Dynamic Programming - Learn to Solve Algorithmic Problems & Coding Challenges; Author: FreecodeCamp.org;https://www.youtube.com/watch?v=oBt53YbR9Kk;License: Standard YouTube License, CC-BY