๐ Baby-Step Giant-Step Algorithm
Compute discrete log in $O(\\sqrt{n})$ time and space, where $n = |G|$.
Proof: Set $m = \\lceil\\sqrt{n}\\rceil$.
Baby steps: compute $g^0, g^1, \\ldots, g^{m-1}$ and store in table.
Giant steps: compute $hg^{-m}, hg^{-2m}, \\ldots$ until match found.
If $g^j = hg^{-im}$, then $x = im + j$.
At most $m$ steps of each type, so $O(\\sqrt{n})$ total.
From: Algebraic Number Theory
Learn more:
Explore all courses: 
Number Theory and Cryptography | Math Academy
Interactive course for learning Number Theory and Cryptography

Magic Internet Math
Interactive courses covering the mathematics that powers modern technology, from foundational algebra to the cryptography securing the internet.