TrueElseFalse & Seren
TrueElseFalse TrueElseFalse
Hey Seren, I’ve been trying to run quicksort on a 1970s mainframe and keep hitting stack overflows unless I inline the partition routine. What do you think about memoizing the pivot selection to keep recursion depth in check?
Seren Seren
Sounds like a classic recursion pain. Memoizing pivots can help, but you’ll still hit the stack limit if you keep recursing on large subarrays. Maybe try a tail‑recursive loop or switch to an iterative quicksort for those old machines. That way you keep the call stack shallow and avoid overloading the 1970s CPU.
TrueElseFalse TrueElseFalse
Thanks, I’ll give the iterative version a shot and maybe add a sentinel loop. The old CPU is still stubborn about tail calls, so I’ll keep a manual stack array and hope it doesn’t blow up again. Appreciate the help!
Seren Seren
Glad you found a direction. Keep an eye on the stack size and maybe add a guard for the sentinel. Let me know how it turns out.
TrueElseFalse TrueElseFalse
Will do—added a sentinel guard and a manual stack that doubles in size each pass. The 1970s CPU still complains, but at least the stack isn’t exploding anymore. Will ping if anything else pops up.