This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: CS 473 Homework 6 (due March 16, 2010) Spring 2010 CS 473: Undergraduate Algorithms, Spring 2010 Homework 6 Written solutions due Tuesday, March 16, 2010 at noon 1. (a) Describe and analyze an algorithm to compute the size of the largest connected component of black pixels in an n n bitmap B [ 1 .. n ,1 .. n ] . For example, given the bitmap below as input, your algorithm should return the number 9, because the largest conected black component (marked with white dots on the right) contains nine pixels. 9 (b) Design and analyze an algorithm B LACKEN ( i , j ) that colors the pixel B [ i , j ] black and returns the size of the largest black component in the bitmap. For full credit, the amortized running time of your algorithm (starting with an all-white bitmap) must be as small as possible. For example, at each step in the sequence below, we blacken the pixel marked with an X . The largest black component is marked with white dots; the number underneath shows the correct output of the B LACKEN algorithm.LACKEN algorithm....
View Full Document
- Spring '08