From: Brian Candler Date: 2012-06-29T16:28:12+09:00 Subject: Re: stack level too deep for quicksort code Ryan Davis wrote in post #1066579: > On Jun 28, 2012, at 16:02 , bei zhao wrote: > >> I tried to add puts after >> left,right=parti(items,0,items.length) >> and see iterate outputs. >> >> Any thoughts? > > Write tests. > > Start with an empty array, then 1, then 2, then many. And add in lots of prints, for example at the start of each function, perhaps also just before it returns. def quicksort(items) puts "Entering quicksort(#{items.inspect})" ... Add more in as you home in on where the problem is. -- Posted via http://www.ruby-forum.com/.