Re: Quicksort with accumulator

2010-12-28 Thread Baishampayan Ghose
>> I tried writing a naive implementation of quicksort using an >> accumulator. Right now, the code is stack-consuming and returns a >> stackoverflowerror on large lists. Is there any way to prevent it from >> consuming stack with some changes? The code is as follows - > > You don't say what your t

Re: Quicksort with accumulator

2010-12-28 Thread Mike Meyer
On Tue, 28 Dec 2010 19:50:28 +0530 Baishampayan Ghose wrote: > Hello, > > I tried writing a naive implementation of quicksort using an > accumulator. Right now, the code is stack-consuming and returns a > stackoverflowerror on large lists. Is there any way to prevent it from > consuming stack wi

Re: Quicksort with accumulator

2010-12-28 Thread Petr Gladkikh
And also qsort may take up to n stack frames for collection of n elements if you partition function is not optimal. In your case - if input collection is sorted (as long as you split by first element). On Tue, Dec 28, 2010 at 11:13 PM, Petr Gladkikh wrote: > Why do you call qsort* inside of parti

Re: Quicksort with accumulator

2010-12-28 Thread Petr Gladkikh
Why do you call qsort* inside of partify? I do not really grasp your logic behind this. On Tue, Dec 28, 2010 at 8:20 PM, Baishampayan Ghose wrote: > Hello, > > I tried writing a naive implementation of quicksort using an > accumulator. Right now, the code is stack-consuming and returns a > stacko

Quicksort with accumulator

2010-12-28 Thread Baishampayan Ghose
Hello, I tried writing a naive implementation of quicksort using an accumulator. Right now, the code is stack-consuming and returns a stackoverflowerror on large lists. Is there any way to prevent it from consuming stack with some changes? The code is as follows - (declare qsort qsort* partify)