Data Structures & Algorithms
Complete catalog of 99 interactive algorithm visualizers. Browse by data structure category or filter by difficulty.
Determine if a binary tree is height-balanced (depth of the two subtrees of every node never differs by more than 1).
Traverse binary tree nodes level-by-level from left to right using a FIFO queue (BFS).
Find the maximum path sum along any sequence of nodes in a binary tree using bottom-up postorder DFS (ignoring negative subtrees).
Return the values of the nodes you can see ordered from top to bottom when standing on the right side of the binary tree.
Traverse binary tree levels alternating directions (left-to-right on even levels, right-to-left on odd levels).
Count nodes in a complete binary tree in less than O(n) time by comparing left and right subtree heights.
Count the number of 'good' nodes in a binary tree (a node X is good if on the path from root to X there are no nodes with value greater than X).
Compute the diameter (longest path between any two nodes) by finding max(leftDepth + rightDepth) at each node using postorder DFS.
Visit binary tree nodes in Left -> Root -> Right order producing sorted order for Binary Search Trees.
Invert a binary tree by recursively swapping the left and right child subtrees of every node.
Find the kth smallest element (1-indexed) in a Binary Search Tree (BST) using in-order DFS traversal step counting.
Find the lowest common ancestor (LCA) node of two given nodes p and q in a Binary Search Tree (BST) using value comparisons.
Find the maximum depth (height) of a binary tree by calculating 1 + max(leftDepth, rightDepth) recursively.
Calculate the maximum width among all levels of a binary tree by assigning 0-indexed position coordinates and normalizing each level against its starting index.
Determine if the binary tree has a root-to-leaf path such that adding up all values along the path equals targetSum.
Find all unique root-to-leaf paths where the sum of the node values equals targetSum using DFS backtracking.
Visit binary tree nodes in Left -> Right -> Root order for bottom-up calculation and subtree evaluation.
Visit binary tree nodes in Root -> Left -> Right order using DFS recursion and call stack unwinding.
Check if two binary trees are structurally identical and have the same node values using simultaneous DFS recursion.
Check if binary tree subRoot is a subtree of root with identical structure and node values.
Calculate the total sum of all numbers formed along root-to-leaf paths (each path represents a decimal number).
Check whether a binary tree is a mirror of itself (symmetric around its center) using simultaneous dual-pointer DFS recursion.
Determine if a binary tree is a valid Binary Search Tree (BST) where every node satisfies min < node.val < max recursively.
