def split_node
      unless @parent
        # The node is the root node. We need to create a parent node first.
        self.parent = @store.new(BigTreeNode, @tree, false)
        @parent.children[0] = myself
        @tree.root = @parent
      end

      # Create the new sibling that will take the 2nd half of the
      # node content.
      sibling = @store.new(BigTreeNode, @tree, is_leaf?, @parent, myself,
                           @next_sibling)
      # Determine the index of the middle element that gets moved to the
      # parent. The node size must be an uneven number.
      mid = @keys.size / 2
      # Insert the middle element key into the parent node
      @parent.insert_element(@keys[mid], sibling)
      if is_leaf?
        # Copy the keys and values from the mid element onwards into the new
        # sibling node.
        sibling.keys += @keys[mid..-1]
        sibling.values += @values[mid..-1]
        # Delete the copied keys and values from this node.
        @values.slice!(mid..-1)
      else
        # Copy the keys from after the mid value onwards to the new sibling
        # node.
        sibling.keys += @keys[mid + 1..-1]
        # Same for the children.
        sibling.children += @children[mid + 1..-1]
        # Reparent the children to the new sibling parent.
        sibling.children.each { |c| c.parent = sibling }
        # And delete the copied children references.
        @children.slice!(mid + 1..-1)
      end
      # Delete the copied keys from this node.
      @keys.slice!(mid..-1)

      @parent
    end
def split_node
      unless @parent
        # The node is the root node. We need to create a parent node first.
        self.parent = @store.new(BigTreeNode, @tree, false)
        @parent.children[0] = myself
        @tree.root = @parent
      end

      # Create the new sibling that will take the 2nd half of the
      # node content.
      sibling = @store.new(BigTreeNode, @tree, is_leaf?, @parent, myself,
                           @next_sibling)
      # Determine the index of the middle element that gets moved to the
      # parent. The node size must be an uneven number.
      mid = @keys.size / 2
      # Insert the middle element key into the parent node
      @parent.insert_element(@keys[mid], sibling)
      if is_leaf?
        # Copy the keys and values from the mid element onwards into the new
        # sibling node.
        sibling.keys += @keys[mid..-1]
        sibling.values += @values[mid..-1]
        # Delete the copied keys and values from this node.
        @values.slice!(mid..-1)
      else
        # Copy the keys from after the mid value onwards to the new sibling
        # node.
        sibling.keys += @keys[mid + 1..-1]
        # Same for the children.
        sibling.children += @children[mid + 1..-1]
        # Reparent the children to the new sibling parent.
        sibling.children.each { |c| c.parent = sibling }
        # And delete the copied children references.
        @children.slice!(mid + 1..-1)
      end
      # Delete the copied keys from this node.
      @keys.slice!(mid..-1)

      @parent
    end
Split the current node into two nodes. The upper half of the elements
 will be moved into a newly created node. This node will retain the lower
 half.
 @return [BigTreeNode] common parent of the two nodes