Module: Algorithmable::Searches

Included in:
Cups::NumberOfOccurrencesInArray
Defined in:
lib/algorithmable/searches.rb,
lib/algorithmable/search/binary_search.rb,
lib/algorithmable/search/binary_search_tree.rb

Defined Under Namespace

Classes: BinarySearch, BinarySearchTree

Instance Method Summary collapse

Instance Method Details

#binary_search(element, collection) ⇒ Object


6
7
8
# File 'lib/algorithmable/searches.rb', line 6

def binary_search(element, collection)
  BinarySearch.lookup(element, collection)
end

#new_binary_search_tree(key_type, value_type) ⇒ Object


10
11
12
# File 'lib/algorithmable/searches.rb', line 10

def new_binary_search_tree(key_type, value_type)
  BinarySearchTree.new key_type, value_type
end