Implementing binomial option pricing trees
This medium-difficulty coding problem in C++ or Python tests your ability to build and traverse a lattice structure, handle node reuse efficiently, and implement the backward-induction algorithm used in quantitative finance. Quant trading firms use this question to assess whether you can translate textbook option theory into correct, efficient code.
The problem requires you to construct a recombining binomial tree where stock prices branch up (multiply by u) or down (multiply by d), then price options by computing expected payoffs recursively from the leaves backward to the root. The key challenge is managing node identity: when two paths reconverge to the same price at the same level, they must reference the same node object, not duplicate it. You must also handle both call and put payoff calculations and round prices consistently to avoid numerical drift.
- Tree construction and path compression (node reuse)
- Recursive option valuation via risk-neutral expectation
- Handling both American and European-style payoff semantics
- Numerical precision and rounding under iteration