Bfs

Alien Dictionary

Given a sorted dictionary of alien language, find the order of characters in the alien alphabet

BFS Shortest Path in Unweighted Graph (O(V+E))

Learn BFS shortest path in an unweighted graph: O(V+E) time, queue + parent[] for path reconstruction. Step-by-step for interviews—start now.

Breadth First Search (Shortest Reach)

Compute shortest distances from a start node in an undirected graph with uniform edge weight using BFS.

Breadth-First Search (BFS) Algorithm: Queue + O(V+E)

Learn BFS traversal with a FIFO queue + visited set. Includes BFS pseudocode, example, and O(V+E) complexity—practice for FAANG interviews.

Clone Graph

Create a deep copy of an undirected graph represented with adjacency lists

Course Schedule

Determine if you can finish all courses given prerequisite relationships using topological sorting

Detect Cycle in Undirected Graph (DFS/BFS, Union-Find)

Learn graph cycle detection in an undirected graph using DFS/BFS parent tracking or Union-Find (DSU). O(V+E). Step-by-step—practice now.

Invert Binary Tree

Invert (mirror) a binary tree by swapping left and right children

Is Graph Bipartite

Check if a graph can be colored with exactly two colors such that no two adjacent nodes have the same color

Jump Game II

Given an array where each element represents the maximum jump length, find the minimum number of jumps to reach the last index

LC 103 Zigzag Level Order Traversal (BFS) Guide

Solve binary tree zig zag/spiral traversal with optimal BFS + deque. O(n) time, O(w) space. Step-by-step for interviews—practice now.

Level Order Traversal

Traverse a binary tree level by level from left to right.

Maximum Depth of Binary Tree

Find the maximum depth (height) of a binary tree

Number of Islands

Count the number of islands in a 2D grid

Rotten Oranges Problem

Find the minimum time for all oranges to rot using BFS

Serialize and Deserialize Binary Tree

Serialize a binary tree to a string and deserialize it back to the original tree

Topological Sort

Find a linear ordering of vertices in a directed acyclic graph

Vertical Order Traversal of Binary Tree

Traverse a binary tree vertically and return nodes by columns

Word Ladder

Find the shortest transformation sequence from beginWord to endWord using single character changes