lib/ruby_algorithms/algorithms/search/graphs/bst.rb
def insert( key )
    if @root.nil?
      @root = Node.new( key )
    else
      @root.insert( key )
    end
  end
# Inserting at the BinarySearchTree level looks if there is a @root node, if not
# it creates one. If there is then the insert is delegated the the Node level.
Inserting at the BinarySearchTree level looks if there is a @root node, if not
it creates one. If there is then the insert is delegated the the Node level.
Inserting at the BinarySearchTree level looks if there is a @root node if not it creates one . If there is then the insert is delegated the the Node level .
def insert( key )
    if @root.nil?
      @root = Node.new( key )
    else
      @root.insert( key )
    end
  end
def insert ( key ) if @root . nil? @root = Node . new ( key ) else @root . insert ( key ) end end
Inserting at the BinarySearchTree level looks if there is a @root node, if not
it creates one.
Inserting at the BinarySearchTree level looks if there is a @root node if not it creates one .
key