proof format updates using gfm
This commit is contained in:
@@ -260,7 +260,8 @@ $$
|
||||
|
||||
Claim: the solution to this recurrence is $E[T(n)]=O(n\log n)$ or $T(n)=c'n\log n+1$.
|
||||
|
||||
Proof:
|
||||
<details>
|
||||
<summary>Proof</summary>
|
||||
|
||||
We prove by induction.
|
||||
|
||||
@@ -296,10 +297,13 @@ If $c'\geq 8c$, then $T(n)\leq c'n\log n+1$.
|
||||
|
||||
$E[T(n)]\leq c'n\log n+1=O(n\log n)$
|
||||
|
||||
QED
|
||||
</details>
|
||||
|
||||
A more elegant proof:
|
||||
|
||||
<details>
|
||||
<summary>Proof</summary>
|
||||
|
||||
Let $X_{ij}$ be an indicator random variable that is $1$ if element of rank $i$ is compared to element of rank $j$.
|
||||
|
||||
Running time: $$X=\sum_{i=0}^{n-2}\sum_{j=i+1}^{n-1}X_{ij}$$
|
||||
@@ -344,6 +348,5 @@ E[X]&=\sum_{i=0}^{n-2}\sum_{j=i+1}^{n-1}\frac{2}{j-i+1}\\
|
||||
\end{aligned}
|
||||
$$
|
||||
|
||||
|
||||
QED
|
||||
</details>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user