From: James Edward Gray II Date: 2005-07-27T04:42:30+09:00 Subject: Re: [QUIZ] Drawing Trees (#40) On Jul 26, 2005, at 2:21 PM, Dominik Bathon wrote: >>>> def extract( ) >>>> extracted = @heap[1] >>>> @heap[1] = @heap.pop unless @heap.size.zero? >>>> sift_down >>>> extracted >>>> end >>>> >>>> >>> >>> This doesn't really extract the last element... >>> >> >> Can you please show a failing example? I tried to find one and >> couldn't. >> > > Maybe I havn't been clear enough, I meant the heap can't get empty, > you can't remove the last remaining element: Got it. Thanks for the lesson Dominik! James Edward Gray II