dsa4 min read
GCD, LCM, and Extended Euclidean Algorithm
Master GCD/LCM with Euclidean algorithm O(log n) and the Extended Euclidean for modular inverse computation.
Read →
1575 articles
Master GCD/LCM with Euclidean algorithm O(log n) and the Extended Euclidean for modular inverse computation.
Generate all primes up to n in O(n log log n) with the Sieve of Eratosthenes. Includes segmented sieve and prime factorization variants.
Master mathematical algorithms for DSA: primes, GCD, modular arithmetic, combinatorics, and fast exponentiation with 5-language implementations.
Master advanced graph algorithms: Kruskal and Prim MST, Tarjan SCC, articulation points, bridges, Floyd-Warshall all-pairs shortest path, and A* search.
Find the minimum spanning tree of a weighted graph using Kruskal's algorithm. Sort edges by weight, use Union-Find to avoid cycles. O(E log E) time.