From: Robert Klemme Date: 2003-05-28T00:08:13+09:00 Subject: Re: Binary Tree vs. Hash "ahoward" schrieb im Newsbeitrag news:Pine.LNX.4.53.0305271414370.28367@eli.fsl.noaa.gov... > On Mon, 26 May 2003, Brian Candler wrote: > > > It doesn't, because Array doesn't have any requirement to be sorted. > > it does not - but it certainly can be. i've often wondered why Array does not > carry an internal @sorted flag - which could be used as a hint for certain > operations - like Array#include? IMHO that's overly complicating Array. An Array is simply a sequence of items. Period. To have a sorted array I'd have either - a sub class of Array (like SortedArray) that overrides modifying operations to ensure this invariant (or do it dependend on the flag you mentioned) or - a SortedArray delegating all non modifying calls to an array and overriding modifying methods. I think this is the more component oriented approach. Regards robert