4 ms·
For non recursive quicksorts see code at bottom of this link: https://www.geeksforgeeks.org/iterative-quick-sort/ https://www.geeksforgeeks.org/iterative-quick-
by ivalm 7y ago
For non recursive quicksorts see code at bottom of this link:
https://www.geeksforgeeks.org/iterative-quick-sort/ https://www.geeksforgeeks.org/iterative-quick-sort/
- kccqzy 7y agoThat link basically just simulates recursion by defining a stack in the function. It recognizes that in the recursive version among the stack variables only the two indexes need to be stored so it stores them. It is even less space efficient than the recursive version because it always allocates O(n) space.