What is the flood fill algorithm and how does it relate to graph traversal?

Heisenbug logo
TheHeisenBug

Search

Search across questions, learning content, and hands-on projects

Ace Your Next Tech Interview

5,986+ interview questions across 87 technologies — with expert answers, advanced search, AI-powered assistance, personal highlights, structured learning paths, and hands-on practice projects.

5,986+Questions & Answers
87Technologies
AdvancedSearch
Built-inAsk AI
PersonalHighlights
StructuredLearning Paths
Hands-onPractice Projects

Lifetime Access

One-time payment. No subscriptions. Unlock everything, forever.

$19.90USD

or R$49.90 BRL

FeatureFreePremium
Question titlesAllAll
Answers per topicTop 5All
Learning chaptersFirst 5All
Practice projectsFirst 3All
Highlights
Ask AI
Read tracking
Search

Graphs Interview Questions

  1. [JUNIOR] What is a graph data structure and what are its main components?
  2. [MID] What is depth-first search (DFS) and how does it traverse a graph?
  3. [MID] What is breadth-first search (BFS) and how does it traverse a graph?
  4. [JUNIOR] What is the difference between a directed graph and an undirected graph?
  5. [MID] How do adjacency lists and adjacency matrices differ as graph representations and when would you use each?
  6. [MID] What is the difference between DFS and BFS and when would you choose one over the other?
  7. [MID] How would you detect a cycle in an undirected graph?
  8. [SENIOR] How does Dijkstra's algorithm work and what are its limitations?
  9. [JUNIOR] What are weighted graphs and when are they used?
  10. [JUNIOR] What is the difference between a graph and a tree?
  11. [MID] How would you detect a cycle in a directed graph?
  12. [MID] What is topological sorting and when is it used?
  13. [MID] How would you find the shortest path in an unweighted graph?
  14. [MID] How would you find the number of connected components in an undirected graph?
  15. [SENIOR] How does the Bellman-Ford algorithm work and how does it handle negative edge weights?
  16. [SENIOR] What is a minimum spanning tree and how do Kruskal's and Prim's algorithms find one?
  17. [JUNIOR] What is a cycle in a graph and what is an acyclic graph?
  18. [JUNIOR] What are the common types and categories of graphs?
  19. [JUNIOR] What is a connected graph versus a disconnected graph?
  20. [MID] What is a bipartite graph and how do you determine if a graph is bipartite?
  21. [MID] How do you clone a graph given a reference to one of its nodes?
  22. [MID] What is the time and space complexity of DFS and BFS?
  23. [MID] How would you find all paths from a source to a destination in a directed graph?
  24. [SENIOR] How does the Floyd-Warshall algorithm solve the all-pairs shortest paths problem?
  25. [SENIOR] How would you implement topological sort using both DFS and Kahn's algorithm (BFS)?
  26. [SENIOR] How would you find the shortest path in a weighted graph with constraints such as at most K stops?
  27. [JUNIOR] What is the degree of a vertex in a graph and how does it differ for directed graphs?
  28. [JUNIOR] What is a path in a graph and what is a simple path?
  29. [MID] What is the Union-Find (Disjoint Set) data structure and how is it used in graph algorithms?
  30. [MID] How do you determine whether an undirected graph is a valid tree?
  31. [MID] How would you solve the number of islands problem using graph traversal?
  32. [SENIOR] How do you find strongly connected components in a directed graph?
  33. [SENIOR] How would you determine the correct ordering of characters from a sorted dictionary of an alien language?
  34. [SENIOR] What are critical connections (bridges) in a network and how do you find them using Tarjan's algorithm?
  35. [JUNIOR] What are the advantages and disadvantages of using a graph data structure?
  36. [MID] What is the flood fill algorithm and how does it relate to graph traversal?
  37. [MID] How would you find the root vertex of a directed graph?
  38. [SENIOR] How would you find the longest path in a directed acyclic graph (DAG)?
  39. [SENIOR] How do you solve the course schedule problem to determine if all courses can be finished?
  40. [SENIOR] What is the difference between Kruskal's and Prim's algorithm and when would you prefer one over the other?
  41. [EXPERT] What is maximum network flow and how does the Ford-Fulkerson algorithm solve it?
  42. [EXPERT] What are articulation points (cut vertices) in a graph and how do you find them efficiently?
  43. [SENIOR] How would you find the longest increasing path in a matrix using graph techniques?
  44. [SENIOR] How do you compute the transitive closure of a graph?
  45. [EXPERT] How does the A* search algorithm improve upon Dijkstra's and when is it applicable?
  46. [EXPERT] How do you find a Hamiltonian path or cycle in a graph and why is it computationally hard?
  47. [EXPERT] What is an Euler path and Euler circuit and how do you determine if a graph has one?
  48. [EXPERT] How does bipartite matching work and what is the Hungarian algorithm?
  49. [EXPERT] How would you solve the graph coloring problem and what are its practical applications?
  50. [EXPERT] What is the relationship between graph problems and NP-completeness?
  51. [EXPERT] How do you detect a negative-weight cycle in a graph and why does it matter for shortest path algorithms?
  52. [EXPERT] How would you find the shortest path that visits all nodes in a graph?