Question:medium

What is the main difference between Boundary-Fill and Flood-Fill algorithms?

Show Hint

One algorithm stops at a defined boundary color; the other keeps going while the interior color matches.
Updated On: Jul 2, 2026
  • Boundary-Fill works only for regular shapes
  • Flood-Fill does not require a seed point
  • Boundary-Fill is faster than Flood-Fill
  • Boundary-Fill fills only enclosed regions, while Flood-Fill spreads in all directions
Show Solution

The Correct Option is D

Solution and Explanation

Compare the stopping rule of each algorithm, since that is what really sets them apart.

Boundary-Fill watches for one particular boundary color and halts there:

\[ \text{fill while pixel} \neq \text{boundary color} \]

Flood-Fill instead watches the interior color and keeps going while pixels match the old color, radiating outward in all connected directions:

\[ \text{fill while pixel} = \text{old interior color} \]

Both use a seed and both cope with irregular outlines, so options about seed points, regular shapes, and speed miss the point. The core contrast is that Boundary-Fill is confined to the region enclosed by its boundary color, while Flood-Fill simply spreads over every matching connected pixel.

\[\boxed{\text{Boundary-Fill fills only enclosed regions, while Flood-Fill spreads in all directions}}\]
Was this answer helpful?
0