Comment on this RCR (edit wiki page) | RCRchive home

RCR 162: Binary search

submitted by ch00k on 2003-10-27 09:49:57


This is a legacy RCR. If this is your RCR, please resubmit it using the new format and process.


I propose to add binary search functionality to Enumerable. Add some method can be called for sorted collection (afer sort!) or, maybe it is better to introduce "is-sorted" method or flag
binary_search_first, binary_search_last - to find the first and the last occurence of object with given property
binary_search_all - to return Array of found objects (or iterate a block over them?)

Vote for this RCR

Strongly opposed [1]
Opposed [2]
Neutral [0]
In favor [0]
Strongly advocate [1]

Change the status of this RCR to:

accepted

rejected

withdrawn


Add comments here

not to Enumerable (, 2003-10-30 08:06:08)

not all objects that include Enumerable have a [] operator or are even indexable. Adding this would mean there would be methods in Enumerable that don't work on all Enumerable objects.

Agree (ch00k, 2003-10-30 12:02:52)

Then maybe add 'Indexable' module?

Back to RCRchive.


RCR Submission page and RCRchive powered by Ruby, Apache, RuWiki (modified), and RubLog