The C in CLRS. · Upvoted by , M.S. Computer Science, Stony Brook University (2018) and , M.S Computer Science, University of California, Los Angeles · Author has 842 answers and 40.8M answer views · 10y ·
Both the deterministic and randomized quicksort algorithms have the same best-case running times of [math]O(n \lg n)[/math] and the same worst-case running times of [math]O(n^2)[/math]. The difference is that with the deterministic algorithm, a particular input can elicit that worst-case behavior. With the randomized algorithm, however, no input can always elicit the worst-case behavior. The reason it matters is that, depending on how partitioning is implemented, an input that is already sorted--or almost sorted--can elicit the worst-case behavior in deterministic quicksort.
89.8K views ·
View upvotes
· View 4 shares
· Answer requested by 1 of 7 answers
Something went wrong. Wait a moment and try again.