- #1
mathmari
Gold Member
MHB
- 5,049
- 7
Hey!
At the proof of the theorem that the expected time of Quicksort is $O(n \log n)$, there is the following sentence:
We suppose that the partitions are equally likely, so the possibility that the sizes of the sequences $S_1$ and $S_3$ are $i-1$ and $n-i$, respectively, is $\frac{1}{n}$.
Let $T(n)$ be the expected time of Quicksort.
Taking into consideration all the possible values of $i$, we get the relation: $$T(n)=\sum_{i=1}^{n}\frac{1}{n}[T(i-1)+T(n-i)]+\Theta(n)$$Could you explain to me how we get the above relation?? (Wondering) How did we get the sum?? (Wondering)
At the proof of the theorem that the expected time of Quicksort is $O(n \log n)$, there is the following sentence:
We suppose that the partitions are equally likely, so the possibility that the sizes of the sequences $S_1$ and $S_3$ are $i-1$ and $n-i$, respectively, is $\frac{1}{n}$.
Let $T(n)$ be the expected time of Quicksort.
Taking into consideration all the possible values of $i$, we get the relation: $$T(n)=\sum_{i=1}^{n}\frac{1}{n}[T(i-1)+T(n-i)]+\Theta(n)$$Could you explain to me how we get the above relation?? (Wondering) How did we get the sum?? (Wondering)