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
An object is composed of a 101 × 101 quadrilateral mesh (i.e., 100 × 100 quadrilaterals). On average, each quadrilateral in the mesh projects to 50 pixels. There are 150 objects in the scene. The graphics monitor has resolution 2560 × 1440. Estimate the number of elementary operations needed byi) Z bufferii) Ray casting for which the objects are all spheresiii) Ray casting for which the objects are all complex. For this question, assume that it is easy to test whether a pixel ray intersects a triangle
Please help computer graphics question   Let Z be the set of real integers and R the set of real numbers. The sampling process may be viewed as partitioning the x-y plane into a grid, with the central coordinates of each grid being from the Cartesian product Z2, that is a set of all ordered pairs (zi, zj), with zi and zj being integers from Z. Then, f(x, y) is a digital image if (x, y) are integers from Z2 and f is a function that assigns a gray-level value (that is, a real number from the set R) to each distinct coordinate pair (x, y). What happens to the digital image if the gray levels also are integers? a) The Digital image then becomes a 2-D function whose coordinates and amplitude values are integers b) The Digital image then becomes a 1-D function whose coordinates and amplitude values are integers c) The gray level can never be integer d) None of the mentioned
Converting an image to grayscale simplifies the algorithm and reduces computational requirements prior to extracting the image features. he total bits per pixel (bpp) for this image is 24. This is because for each primary colour (red, green, and blue) there are 8 bits per primary colour, and since there are 3 primary colours, 8 bits x 3 primary colours = 24 bpp. To calculate the size of the image file in bytes, we need to multiply the number of pixels (300 x 400 = 120,000 pixels) by the bpp (24 bits).  120,000 pixels x 24 bits = 2,880,000 bits To convert bits to bytes, divide the number of bits by 8 (2,880,000 bits / 8 = 360,000 bytes). Therefore, the size of the image file in bytes is 360,000.   If the digital image above is converted to grayscale with 8 bpp, calculate the size of this grayscale image file in bytes with disregard to the image compression type. Provide a short explanation on the calculation.
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
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