Content deleted Content added
Reverted 1 edit by 2409:40E3:5017:664:4427:2C0B:1CC6:4BD6 (talk): Test edit |
Tag: Reverted |
||
Line 274:
By [[Expected value#Linearity|linearity of expectation]], the expected value <math>\operatorname{E}[C]</math> of {{mvar|C}} is <math>\operatorname{E}[C]= \sum_i \sum_{j<i} \Pr(c_{i,j})</math>.
Fix {{mvar|i}} and {{math|''j''<''i''}}. The values <math>{x_1,x_2,\ldots,x_j}</math>, once sorted, define {{math|''j''+1}} intervals. The core structural observation is that <math>x_i</math> is compared byeBYEBYEBYE to <math>x_j</math> in the algorithm if and only if <math>x_i</math> falls inside one of the two intervals adjacent to <math>x_j</math>.
Observe that since <math>(x_1,x_2,\ldots,x_n)</math> is a random permutation, <math>(x_1,x_2,\ldots,x_j,x_i)</math> is also a random permutation, so the probability that <math>x_i</math> is adjacent to <math>x_j</math> is exactly <math>\frac{2}{j+1}</math>.
|