Flood Fill Algorithm

About

Flood Fill Algorithm helps in visiting each and every point in given area .It Determines the area connected to given cell in a Multi-Dimensional Array

Real Time Use Case

In MS-Paint, when we take the brush to a pixel and click, the color of the region of that pixel is replaced with a new selected color.

How to use this?

Consider a 2D Array where each block is a pixel on the screen. In this Example First, we need to generate a matrix with a random color filled in the matrix. Click on Generate Matrix. A matrix will be displayed you need to select a new color to fill in the matrix, click on the color you need to change now you will notice it neighbors with the same color is replaced with new select color.

Algorithm Used

Breath First Search

Choose New Color

<