Introduction to Algorithms
Introduction to Algorithms
3rd Edition
ISBN: 9780262033848
Author: Thomas H. Cormen, Ronald L. Rivest, Charles E. Leiserson, Clifford Stein
Publisher: MIT Press
bartleby

Videos

Question
Book Icon
Chapter 15, Problem 8P

(a)

Expert Solution
Check Mark
Program Plan Intro

To show the number of possible seams grows exponential.

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)

Expert Solution
Check Mark
Program Plan Intro

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

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
You are tasked with developing a portable system that can be worn to collect health and fitness data. The challenge is to integrate all functions into the smaller form of an ear clip. The device should include heart rate, movement and temperature sensor and wireless communication with a mobile app. Draw a diagram- hardware architecture of the system- including the selection of suitable sensors, communication modules, and an energy-efficient microcontroller. (visualize the components and their connections)
Draw out an example of 3 systems using Lamport’s logical clock and explain the steps in words.
"Systems have become very powerful and sophisticated, providing quality information fordecisions that enable the firm to coordinate both internally and externally."With reference to the above statement compare the operations of any three data gatheringsystems today’s organisations use to aid decision making.

Chapter 15 Solutions

Introduction to Algorithms

Knowledge Booster
Background pattern image
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