Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

For non recursive quicksorts see code at bottom of this link: https://www.geeksforgeeks.org/iterative-quick-sort/


That 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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: