lib/binary_search_tree/node.rb
def replace_child(child, node = nil)
      @left = node    if left == child
      @right = node   if right == child

      node.parent = self if node
    end
# Finds the child and replaces it with the provided node. This will also set the parent node of the given node.
# @param child [BinarySearchTree::Node] the child node
# @param node [BinarySearchTree::Node] the replacement node
# @return [void]
Finds the child and replaces it with the provided node. This will also set the parent node of the given node.
Finds the child and replaces it with the provided node . This will also set the parent node of the given node .
def replace_child(child, node = nil)
      @left = node    if left == child
      @right = node   if right == child
      node.parent = self if node
    end
def replace_child ( child , node = nil ) @left = node if left == child @right = node if right == child node . parent = self if node end
Finds the child and replaces it with the provided node.
Finds the child and replaces it with the provided node .
None
void
child
the child node
the child node
node
the replacement node
the replacement node