Sebastian Hungerecker wrote:
> The code doesn't create a new array. It just switches the items in the 
> array
> around untill the array is sorted. Of course the items should only be 

Sorry to contradict you Sebastian: the original array isn't sorted, but 
cleared out by this code, since he's calling unsorted_array.pop at each 
level. It only looks like it ends up sorted because of the puts ["bar"] 
at the end of each call.

The '<' is actually the right way round if you going to do it this way 
and pop the last (smallest) element of the list each time and push it 
onto another array.

best,
Dan

-- 
Posted via http://www.ruby-forum.com/.