Search Binary Tree For Post Order

Posted StringBuilder

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Search Binary Tree For Post Order相关的知识,希望对你有一定的参考价值。

 1 public class BinaryTreeNode
 2 {
 3     public Object data;
 4     
 5     public BinaryTreeNode leftPointer;
 6     
 7     public BinaryTreeNode rightPointer;
 8     
 9     public BinaryTreeNode(Object data)
10     {
11         this.data = data;
12     }
13     
14 }
15 
16 public class Solution
17 {
18     public void preOrder(BinaryTreeNode node)
19     {
20         if(node == null)
21         {
22             return;
23         }
24         
25         if(node.leftPointer != null)
26         {
27             preOrder(node.leftPointer);
28         }
29         if(node.rightPointer != null)
30         {
31             preOrder(node.rightPointer);
32         }
33         
34         visit(node);
35     }
36     
37     public void visit(BinaryTreeNode node)
38     {
39         System.out.println(node.data);
40     }
41     
42 }

 

以上是关于Search Binary Tree For Post Order的主要内容,如果未能解决你的问题,请参考以下文章

Search Binary Tree For In Order

[GeeksForGeeks] Populate inorder successor for all nodes in a binary search tree

Binary search tree or not

LC1008 Construct Binary Search Tree from Preorder Traversal

[Leetcode] Binary search tree --Binary Search Tree Iterator

[Lintcode]95. Validate Binary Search Tree/[Leetcode]98. Validate Binary Search Tree