Added functions min_parent() and max_parent, to make the deletion functions more efficient