TL;DR
Expected Depth in a Random Treap: A canonical quantitative trading interview question at foundation difficulty. Commonly asked at Jane Street, HRT, Two Sigma.
By Valenke Exam Prep Team·Last updated 2026-06-01
foundationRandomized Data Structures
Expected Depth in a Random Treap
Asked at: Jane Street, HRT, Two Sigma
Problem
A treap stores keys with random priorities. The tree is simultaneously a BST on keys and a max-heap on priorities. Show that the expected depth of any node is by proving it equals the expected number of "ancestors" — which relates to the same indicator variable trick used in quicksort.
Related concepts
Ready to practice for the Valenke Finance Exam?
Adaptive practice powered by Item Response Theory targets your weak areas. Start with 3 free sessions.
Start free practice →