From: Dominik Bathon Date: 2005-05-13T23:58:47+09:00 Subject: Re: [SUMMARY] Amazing Mazes (#31) On Fri, 13 May 2005 06:35:28 +0200, Martin DeMello wrote: > Ruby Quiz wrote: >> >> Let's get to the code. Dominik starts off by defining a helper method >> in Hash: >> >> class Hash >> # find the key for with the smallest value, delete it and >> return it >> def delete_min_value > > Wonder if > http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/133202 would > be an optimisation. Yes, I know about rbtree, but it isn't in the stdlib, so I didn't want to use it for the quiz. Ruby really lacks a nice sorted set out of the box (SortedSet in set.rb uses rbtree, if it is installed, otherwise it just resorts the elements, when they changed and it has no accessor for the min/max elements). And as I said in my other reply, for this special problem the priority queue isn't necessary at all. Dominik