From: "Jan E." Date: 2012-06-29T18:28:41+09:00 Subject: Re: stack level too deep for quicksort code By the way, this low level element swapping isn't necessary in Ruby. The whole parti method can be replaced by Enumerable#partition: http://ruby-doc.org/core-1.9.3/Enumerable.html#method-i-partition Then the code becomes as simple as this: def quicksort array return array if array.empty? pivot = array.first left, right = array[1..-1].partition {|x| x < pivot} quicksort(left) + [pivot] + quicksort(right) end -- Posted via http://www.ruby-forum.com/.