A sorted list ruins quick sort.
transcript
Quick sort is fast on random lists. What if the list is already sorted?
Take the list one to six. The last value, six, is the pivot. Nothing is larger than six. So one side is empty.
The next range is one to five. Its last value is the largest again. The range shrinks by only one value. This repeats for every value.
Ten values need forty five comparisons. A thousand values need nearly half a million. Five thousand need over twelve million. The count is n times n minus one, over two.
A hundred thousand values need nearly five billion comparisons. At a microsecond each, that is eighty three minutes. The recursion is also a hundred thousand calls deep. In Python, a thousand sorted values already crash it.
A random pivot does not look at the order. On five thousand sorted values it needs about seventy thousand comparisons. That is about a hundred eighty times fewer.
Pick the pivot at random. Full breakdown in the lecture.