Stackless Quicksort | Algorithms Notes
Implement quick iteratively without using a stack.
Solution:
Knuth proposed a solution but he assumes that all elements are positive numbers. The difficulty is that the algorithm needs to know the bound of the part that the algorithm is currently working on. Wegner's solution is to borrow an element from the previous part, which is definitely smaller than all elements in the current part, and use this element as an indicator of the end of the current part.
Read full article from Stackless Quicksort | Algorithms Notes
No comments:
Post a Comment