(Flood or Seed Fill) Below is a pseudocode for a recursive seed fill. void SEED_FILL(int x, int y){ if ((PIXEL_VALUE(x, y) != BoundaryValue) && (PIXEL_VALUE) != FillValue)){ SET_PIXEL(x, y, FillValue); SEED_FILL(x + 1, y); SEED_FILL(x - 1, y); SEED_FILL(x, y + 1); SEED_FILL(x, y - 1); } }For the region shown below, assume BoundaryValue = black, FillValue = gray and that SEED_FILL(4, 6) has been called. a. Number the pixels in the order they are set by the SET_PIXEL(x, y, FillValue) call.
b. Show the stack of recursive calls at the time each pixel is set.
How deep does the stack get?
|
Last Updated: May 27, 2004 5:20 p.m. by