Binary search tree C# delete node function
问题 My delete function doesn't work when I try to delete node with only right child. It works when node has left child only or has both left and right. I would like to know if this is a valid approach to this problem. I know how to write this in C++ but I need it to work in C# also. //Private method, with args: root node, node to be deleted private Node DeleteN(Node root, Node deleteNode) { if (root == null) { return root; } if (deleteNode.data < root.data) { root.left = DeleteN(root.left,