摘要: A graph which is connected and acyclic can be considered a tree. The height of the tree depends on the selected root. Now you are supposed to find the 阅读全文
posted @ 2018-03-09 19:21 blueattack 阅读(154) 评论(0) 推荐(0)
摘要: 已知后序与中序输出前序(先序):后序:3, 4, 2, 6, 5, 1(左右根)中序:3, 2, 4, 1, 6, 5(左根右) 已知一棵二叉树,输出前,中,后时我们采用递归的方式。同样也应该利用递归的思想: 对于后序来说,最后一个节点肯定为根。在中序中可以找到左子树的个数,那么就可以在后序中找到左 阅读全文
posted @ 2018-03-09 17:27 blueattack 阅读(443) 评论(0) 推荐(0)