Algorithm Visualizations

Algorithm Visualizations

Explore algorithm visualizations code snippets and tutorials

Algorithm Visualizations

Manacher longest palindromic substring: Examples & Code

Manacher longest palindromic substring: Reuse mirrored palindrome radii inside the rightmost known palindrome, expanding only when necessary. Return the…

Algorithm Visualizations

Binary search tree insertion, search and deletion: Examples & Code

Binary search tree insertion, search and deletion: Build an unbalanced search tree, insert a key, search for a key, then delete a key using the inorder…

Algorithm Visualizations

Lowest common ancestor (binary lifting): Examples & Code

Lowest common ancestor (binary lifting): Precompute power-of-two ancestors, equalize query depths, then lift both vertices until their parents coincide.…

Algorithm Visualizations

Modular inverse (extended Euclidean): Examples & Code

Modular inverse (extended Euclidean): Use Bézout coefficients to find x such that value × x ≡ 1 modulo modulus, when the GCD is one. Explore a worked example,…

Algorithm Visualizations

Binary reflected Gray code: Examples & Code

Binary reflected Gray code: Map each binary index i to i XOR (i >> 1); adjacent codes differ by one bit. Explore a worked example, complexity and tested code.