From: jake kaiden Date: 2011-12-17T04:00:39+09:00 Subject: Re: Writing My Own Sorting Method (New to Ruby) hi Emeka, surely there are other (and better) ways to do this, but one idea that occurs to me is that you could insert each entry from the startarray into the sortarray at the index that is the entry's length. of course if you have two strings of the same length, they'll be inserted at the same index, but that just pushes everything up one - the entries will still be sorted by length. you'll also end up with a whole bunch of `nil`s in the sort array, but you can remove them with #compact... something like this: startarray = %w[tiddlywinks tacks fiddlesticks jacks pez] sortarray = [] startarray.each{|entry| sortarray.insert(entry.length, entry)} p sortarray.compact => ["pez", "jacks", "tacks", "fiddlesticks", "tiddlywinks"] hth, - j -- Posted via http://www.ruby-forum.com/.