1 package Tree; 2 3 import java.util.ArrayDeque; 4 import java.util.Queue; 5 import java.util.Stack; 6 7 /** 8 * Created by lenovo on 2017/9/6. 9 */ 10 public class BinaryTree { 11 /* 12 * 前序遍历,递归实现 13 * */ 14 public void PreOrder(TreeNode node) { 15 if (node != null) { 16 System.out.print(node.val); 17 PreOrder(node.left); 18 PreOrder(node.right); 19 } 20 } 21
二叉树知道根节点的四种遍历思想
最新推荐文章于 2021-12-22 11:43:43 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)