From: Lars Haugseth Date: 2012-06-30T19:52:49+09:00 Subject: Re: stack level too deep for quicksort code On 06/29/2012 02:32 PM, Jan E. wrote: > Lars Haugseth wrote in post #1066622: >> How about: >> >> pivot = array.shift >> left, right = array.partition {|x| x < pivot} > > I wouldn't do it. This removes the first element from the original > array, which will make no sense to the user. The only time the array is referenced later in the method is when you partition all except the first element, so it makes perfect sense to me. -- Lars Haugseth