From: trans Date: 2009-09-21T12:48:01+09:00 Subject: Re: Multi-Dimensional Arrays in Priority Queues On Sep 20, 10:25 pm, Mason Kelsey wrote: > In my program I need to construct a priority queue that sorts ascending. > The basic idea can be expressed in the following simple code that uses a > Priority Queue concept.  See:http://www.math.kobe-u.ac.jp/~kodama/tips-ruby-pqueue.html First, you may want to try the latest version of this class. I had it in Facets for some time and it has been improved over the years. Recently though, I made it it's own project. You should be able to get it via 'gem install pqueue'. > 1   require "pqueue" > 2 > 3   pq=PQueue.new(proc{|x,y| x pq.push([2], [123456780], [123456708]) You need to bracket the whole thing. pq.push([2, 123456780, 123456708]) However arrays are not comparable, so as has been mentioned: pq=PQueue.new{|x,y| x[0]