What is the probability of comparision between smallest and greatest element in array when quick sort randomly choose the pivot element?

cs.stackexchange https://cs.stackexchange.com/questions/115024

문제

Consider the recursive quick sort with random pivoting i.e. each time a random pivot element is chosen uniformly. When this randomized algorithm is being applied to an array with n distinct element, what is the probability that the smallest and the greatest element will be compared during run of the algorithm.

올바른 솔루션이 없습니다

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 cs.stackexchange
scroll top