public void InOrder(Node theRoot) { if (theRoot != null) { InOrder(theRoot.Left); theRoot.DisplayNode(); InOrder(theRoot.Right); } }
public void PostOrder(Node theRoot) { if (!(theRoot == null)) { PostOrder(theRoot.Left); PostOrder(theRoot.Right); theRoot.DisplayNode(); } }
public void InOrder(Node theRoot) { if(theRoot != null) { InOrder (theRoot.Left); theRoot.DisplayNode (); InOrder (theRoot.Right); } }
public void PostOrderTraversal(Node node) { if (node != null) { PostOrderTraversal(node.Left); PostOrderTraversal(node.Right); node.DisplayNode(); } }
void PrintGivenLevel(Node node, int level) { if (node == null) { return; } if (level == 1) { node.DisplayNode(); } else { PrintGivenLevel(node.Left, level - 1); PrintGivenLevel(node.Right, level - 1); } }
public int FindNode(int key) { Node currentNode = Root; //if (currentNode.Data == key) // return currentNode; while (currentNode.Data != key) { currentNode = key < currentNode.Data ? currentNode.Left : currentNode.Right; if (currentNode == null) { return(0); } } currentNode.DisplayNode(); return(1); //return currentNode.Data; }