function for replacing node in tree
refactor rbt_delete_node