Permalink
Browse files

modify

  • Loading branch information...
ZhangHanDong committed Mar 21, 2011
1 parent 9801331 commit 2fc1342c6cabdd85ce835e91bd8d9f4c93cc5d65
Showing with 19 additions and 19 deletions.
  1. +19 −19 lib/ruby_extendsions/array_extendsions.rb
@@ -57,25 +57,25 @@ def stringify_items
end
# 二分查找返回数组index, 只限于可排序的元素
- def binary_search_index(e, l = 0, u = length - 1)
- return if l>u
- m=(l+u)/2
- begin
- e.to_s < self[m].to_s ? u=m-1 : l=m+1
- e == self[m] ? m : binary_search_index(e,l,u)
- rescue
- nil
- end
- end
-
- def b_include? e
- begin
- temp = self.sort_by{|i| i.to_s}
- !temp.binary_search_index(e).nil?
- rescue
- return false
- end
- end
+ # def binary_search_index(e, l = 0, u = length - 1)
+ # return if l>u
+ # m=(l+u)/2
+ # begin
+ # e.to_s < self[m].to_s ? u=m-1 : l=m+1
+ # e == self[m] ? m : binary_search_index(e,l,u)
+ # rescue
+ # nil
+ # end
+ # end
+ #
+ # def b_include? e
+ # begin
+ # temp = self.sort_by{|i| i.to_s}
+ # !temp.binary_search_index(e).nil?
+ # rescue
+ # return false
+ # end
+ # end
#比较两个数组内容相同,不包含顺序
def compare_content com_arr

0 comments on commit 2fc1342

Please sign in to comment.