标签:out oid middle class pre ret void before nod
/* * 先根序 */ public static void beforeShow(Node node) { if (node == null) { return; } System.out.println(node.data); beforeShow(node.left); beforeShow(node.right); } /* * 中根序 */ public static void middleShow(Node node) { if (node == null) { return; } middleShow(node.left); System.out.println(node.data); middleShow(node.right); } /* * 后根序 */ public static void lastShow(Node node) { if (node == null) { return; } lastShow(node.left); lastShow(node.right); System.out.println(node.data); }
递归遍历二叉树:
标签:out oid middle class pre ret void before nod
原文地址:http://www.cnblogs.com/wangxiaowang/p/7818799.html