From: alex zz Date: 2012-06-30T00:25:32+09:00 Subject: Re: stack level too deep for quicksort code Updates: Actually the reason I skipped the 7-line solution and did this low level implementation is by the requirement of the course. I'm following algorithm class on coursera. It's true that array like [1,2] will break parti, because it will swap array[0] with array[i-1], basically array[0] it self. I change the code to if i-2>=0 return s[0..i-2],s[i..r] else return Array.new,s[i..r] end now it works. Thanks everyone who read and replied -- Posted via http://www.ruby-forum.com/.