public void PrintInorderTraversal(BinaryTreeNode binaryTreeNode) { if (binaryTreeNode == null) { return; } PrintInorderTraversal(binaryTreeNode.GetBinaryTreeNodeLeft()); Console.Write(binaryTreeNode.GetBinaryTreeNodeData() + " "); PrintInorderTraversal(binaryTreeNode.GetBinaryTreeNodeRight()); }
private static void _SerializeBinaryTree(BinaryTreeNode binaryTreeNode, StreamWriter streamWriter) { if (binaryTreeNode == null) { streamWriter.WriteLine("-1"); return; } streamWriter.WriteLine(binaryTreeNode.GetBinaryTreeNodeData() + ""); _SerializeBinaryTree(binaryTreeNode.GetBinaryTreeNodeLeft(), streamWriter); _SerializeBinaryTree(binaryTreeNode.GetBinaryTreeNodeRight(), streamWriter); }