Flood Fill Algorithm with Recursive Functionby@Ayve_178
4,914 reads

Flood Fill Algorithm with Recursive Function

tldt arrow
Read on Terminal Reader
Read this story w/o Javascript

Too Long; Didn't Read

The “Bucket” tool of Microsoft Paint is used to fill an area with single specific color. We are going to discuss the algorithm behind the bucket tool. We will solve this problem using a Recursive Function. The idea is simple. At first we replace the color of current pixel and then we will go in 8 directions(N, S, W, E, NW, NE, SW, SE) and convert all the previous color values into the new color values. Then we will get the image with new color. The following is the implementation of the Flood Fill Algorithm.

Companies Mentioned

Mention Thumbnail
Mention Thumbnail
featured image - Flood Fill Algorithm with Recursive Function
Khairun Nessa Ayve HackerNoon profile picture

@Ayve_178

Khairun Nessa Ayve

I am a learner.


Receive Stories from @Ayve_178

react to story with heart

RELATED STORIES

L O A D I N G
. . . comments & more!