Ruby-BST/main.rb
#Addhelper function: used to traverse the tree using the compare_proc and returns true if the item is found
Addhelper function: used to traverse the tree using the compare_proc and returns true if the item is found
Addhelper function : used to traverse the tree using the compare_proc and returns true if the item is found
def includeHelper(current, item)
    if current.nil?
      false
    elsif @compare_proc.call(item, current.value) == 0
      true
    elsif @compare_proc.call(item, current.value) == -1
      includeHelper(current.left, item)
    else
      includeHelper(current.right, item)
    end
  end
def includeHelper ( current , item ) if current . nil? false elsif @compare_proc . call ( item , current . value ) == 0 true elsif @compare_proc . call ( item , current . value ) == - 1 includeHelper ( current . left , item ) else includeHelper ( current . right , item ) end end
Addhelper function: used to traverse the tree using the compare_proc and returns true if the item is found
Addhelper function : used to traverse the tree using the compare_proc and returns true if the item is found
current
<not_specific>
item
<not_specific>