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)

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
Integral image is obtained by summing all the pixels before each pixel (Naively you can think of this as similar to the cumulative distribution function where a particular value is obtained by summing all the values before). Let's take an example to understand this. Suppose we have a 5x5 binary image as shown below. The integral image is shown on the right. 2, 1, 2, 2], 1, 1, 3, 3], 5, 5], 8], [1, 2, 2, 5, [2, 4, 4, 8, [ 3, 5, 5, 9, 10]]. Integral image All the pixels in the integral image are obtained by summing all the previous pixels. Previous here means all the pixels above and to the left of that pixel (inclusive of that pixel). For instance, the 3 (blue circle) is obtained by adding that pixel with the above and left pixels in the input image i.e. 1+0+0+1+0+0+0+1 = 3. [[1, 0, 0, 1, 0], [0, 0, 0, 1, 0], [0, 1, 0, 1, 0], [1, 1, 0, 1, 0], [1, 0, 0, 0, 1]] Original image [[1, 1, 1, [1, Write a function integral_image () that takes as parameter an image in the form of a nested list A…
A point in 3D space has coordinates [-10,-40,500] mm relative to the camera reference frame. If the camera has an image plane at distance f'=33 mm from its optical centre, the CCD array is 10 mm by 14 mm and is divided into 340 by 240 pixels, and the image principal point is at coordinates [170,120] pixels, then determine the coordindates (in pixels) where the point will appear in the image using the pinhole camera model of image formation. ANSWER: Coordinates of point in image: (
The issue: You are programming a graphics filter that filters each individual picture. The definition of a pixel is a triplet of real integers (R, G, and B), each of which ranges from 0 to 255. For the filtering methods to function properly, real numbers must be used. However, after looking at the software, you find that they only require two digits of accuracy. Any extra numbers are just unnecessary.
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
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