Beispiel #1
0
 /// <summary>
 /// 后序遍历
 /// </summary>
 /// <param name="node"></param>
 public void PostOrder(Node node)
 {
     if (node != null)
     {
         PostOrder(node.Left);
         PostOrder(node.Right);
         node.DispalyNode();
     }
 }
Beispiel #2
0
 /// <summary>
 /// 前序遍历
 /// </summary>
 /// <param name="node"></param>
 public void PreOrder(Node node)
 {
     if (node != null)
     {
         node.DispalyNode();
         PreOrder(node.Left);
         PreOrder(node.Right);
     }
 }
Beispiel #3
0
 /// <summary>
 /// 倒序
 /// </summary>
 /// <param name="node"></param>
 public void BackOrder(Node node)
 {
     if (node != null)
     {
         BackOrder(node.Right);
         node.DispalyNode();
         BackOrder(node.Left);
     }
 }
Beispiel #4
0
 /// <summary>
 /// 中序遍历
 /// </summary>
 /// <param name="node"></param>
 public void InOrder(Node node)
 {
     if (node != null)
     {
         InOrder(node.Left);
         node.DispalyNode();
         InOrder(node.Right);
     }
 }