AlgoThrive
← All recursion topics

Euclid's GCD

ActiveReturned

call stack

last in, first out

gcd(48, 18)

pseudocode

gcd(a, b)
if b == 0: return a
return gcd(b, a mod b)

Frame 1 / 13

Call gcd(48, 18)

start

4

a: 1–500, b: 1–500