Data Structures · Recursion

How pascal(row, col) uses the call stack

Every entry in Pascal's triangle is the sum of the two entries above it, so each call makes two recursive calls. Step through and watch a frame pause twice: once while it waits for left, and again while it waits for right. The triangle shows how often the same entry gets recomputed.