Medium Algorithms Graph Algorithms
Explain the flood fill algorithm and its applications.
Answer
Flood fill starts from a seed point and fills connected regions with a new color. Implementation uses BFS or DFS: check if current cell matches target color, if yes change to new color and recursively/iteratively process neighbors (4-directional or 8-directional). Time O(m*n) for m*n grid. Applications: paint bucket tool in image editors, solving maze, finding connected components, region labeling in image processing.
IIT Certified
Master These Concepts with IIT Certification
175+ hours of industry projects. Get placed at Bosch, Tata Motors, L&T and 500+ companies.
Relevant for Roles
Software Engineer Graphics Developer Game Developer