From: Ben Tilly Date: 2001-02-11T13:08:00+09:00 Subject: [ruby-talk:10698] Re: heap data structure Jon Aseltine wrote: > >Michael Davis wrote: > > > > Can I make the heap a static or fixed size? For example, I want the >heap to be 2K regardless of how many items it contains. > > > > Can I marshal dump and load heaps? > > > > I think this may be just want I need to create a btree for ruby. > >No, I don't think there is an easy way to make a heap do these things. >Heaps grow dynamically as new keys are inserted -- there is no way >around this. Why don't you just write a B-tree class? Chapter 19 of >"Introduction to Algorithms" by Cormen, Leiserson, and Rivest should >give you enough of a background (and pseudocode) to write a nice Ruby >class. If you don't have that book, you can also get the necessary background and read a Perl implementation at http://perl.plover.com/BTree/article.html. Cheers, Ben _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com