[ruby-talk:02447] Re: Wider need for Array.lookup

From: Hideto ISHIBASHI <hideto-i@...4u.or.jp>
Date: 2000-04-11 13:03:53 UTC
List: ruby-talk #2447
> Additionally I believe it performs O(n) while hash should be O(c).
> Btw. is there need for SortedArray with Array.index O(n log n)?

The Container Library, container.rb, provides Set, Bag,
OrderedCollection, SortedCollection, LinkedList.
This may suite for your purpose.

But I don't know where(URL) it is. Hmm...
Perhaps in RAA or somewhere.

And tips:
>     self.each_index{|c| ret[self[c]] = c }

Why don't you use this? :)
:     self.each_with_index{|e,c| ret[e] = c }


Regards,

--
Hideto "rubyholic" ISHIBASHI

In This Thread