Probability of comparing 3 elements pairwise using random quick sort

Job ID: 36711681

Budget: $10 – $30 CAD

Pivots are selected uniformly at random and independently of each other. The set to be sorted consists of n distinct numbers.
Let us denote the oredered list of them by s1 < s2 < · · · < sn. What is the
probability that the numbers si
, sj and sr will (all) be compared pairwise?
Related categories: Algorithm Statistics Mathematics