- Notifications
You must be signed in to change notification settings - Fork 0
Maximum recursion depth #1
Copy link
Copy link
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
Maximum recursion depth exceed when using Quick Sort.
This issue has already been discussed here on Stack Overflow.
While QuickSort is
O(NlogN)with most lists, it has a worst case ofO(N^2)- in particular (using the standard pivot rules) with already-sorted lists. And when this happens, your stack depth can end up beingO(N). So, if you have 1000 elements, arranged in worst-case order, and you're already one frame into the stack, you're going to overflow.