I'm reading CLRS and also watching Stanford university Algorithm courses on Coursera by Tim Roughgarden. Running time analysis of the algorithm is based on the probability that two entries in the array will ever be compared. It is not very easy to comprehend so I tried to approach the analysis in a little bit other way but I am not sure if it is correct.
Basically I try to calculate the expected pivot index returned every time partition subroutine is called.
Let pivot be expected pivot index returned every time the partition subroutine is called.

Which shows that we can expect that partition subroutine will split the subarray equally. With recursion tree illustration it would be simple to show that the depth of the tree will be log(n) and at each level of the tree it takes O(n) to partition the subarrays. Is this correct?
