DAA Divide & Conquer Karatsuba

Karatsuba Integer Multiplication — Interactive D&C Tutor

Multiply large integers faster by reducing 4 half-size multiplications to 3. Use Step / Auto to see split → Z0/Z1/Z2 → combine.

← Back
Inputs

Tip: Try 1234 × 5678. We auto-pad digits to a power of 2 (assumption in pseudocode).

Message
Enter X and Y, then click Start.
Visualization
Step: 0 / 0
Active Call n = —
pad: — depth: 0
X
XH
XL
Y
YH
YL
Z0 = Karatsuba(XL, YL)
low × low
Z2 = Karatsuba(XH, YH)
high × high
Z1 = Karatsuba(XH+XL, YH+YL)
cross via trick
Combine
P = Z2·B^(2m) + (Z1 − Z2 − Z0)·B^m + Z0
Result: —
Call Stack (Top = Latest) Depth: 0
Recursion Tree (click to collapse)
Start the simulation to build the tree.

Each node is a Karatsuba(…) call. You should see 3 children: Z0, Z2, Z1.

Watch how the algorithm replaces 4 multiplications with 3 each level.

Karatsuba’s recurrence: T(n)=3T(n/2)+O(n)O(nlog₂3) ≈ O(n1.585).