BFS
Everything on SkillVeris tagged BFS — collected across the glossary, study notes, blog, and cheat sheets.
15 resources across 3 libraries
Study Notes(1)
Cheat Sheets(1)
Interview Questions(13)
Difference Between Stack and Queue
A stack is a LIFO (Last In, First Out) structure where the last element added is the first removed, while a queue is a FIFO (First In, First Out) structure whe…
BFS vs DFS: What is the Difference?
BFS (breadth-first search) explores a graph level by level using a queue, while DFS (depth-first search) explores as deep as possible along one path before bac…
What is a Graph?
A graph is a data structure made of nodes (vertices) connected by edges, used to model relationships and connections such as networks, maps, or dependencies, a…
What is Topological Sort?
Topological sort produces a linear ordering of the nodes in a directed acyclic graph such that for every directed edge from node A to node B, A appears before…
What is Level-Order Tree Traversal?
Level-order traversal visits a binary tree one depth level at a time, left to right, by pushing the root into a FIFO queue and repeatedly dequeuing a node, vis…
Word Ladder Problem: How Would You Solve It?
Word ladder is solved with BFS over an implicit graph where each word is a node and an edge connects two words differing by exactly one letter, because BFS exp…
Number of Islands Problem: How Would You Solve It?
Number of islands is solved by scanning the grid and, each time an unvisited land cell is found, running a flood-fill (DFS or BFS) that marks every orthogonall…
What is the Flood Fill Algorithm?
Flood fill is a traversal algorithm that starts at a given cell in a grid and recursively or iteratively spreads to all orthogonally (or optionally diagonally)…
How Do You Find the Shortest Path in an Unweighted Graph?
The shortest path between two vertices in an unweighted graph is found with breadth-first search (BFS), which explores the graph level by level from the source…
What is the Single-Source Shortest Path Problem?
Single-source shortest path (SSSP) finds the minimum-cost route from one fixed source vertex to every other reachable vertex in a graph, solved with BFS for un…
How Do You Check if a Graph is Bipartite?
A graph is bipartite if its vertices can be split into two groups so that every edge connects a vertex in one group to a vertex in the other, and you check thi…
What is the Aho-Corasick Algorithm?
Aho-Corasick is a multi-pattern string-matching algorithm that builds a trie of all patterns augmented with failure links, letting it search text for every occ…
Weighted vs Unweighted Graphs: What is the Difference?
A weighted graph attaches a numeric cost or value to each edge, such as distance or price, while an unweighted graph only records that a connection exists with…