摘要: 题目: Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binary tree is symmetric: But the 阅读全文
posted @ 2016-05-14 17:29 zhangbaochong 阅读(539) 评论(0) 推荐(0) 编辑
摘要: 对于一颗二叉树,深度优先搜索(Depth First Search)是沿着树的深度遍历树的节点,尽可能深的搜索树的分支。以上面二叉树为例,深度优先搜索的顺序 为:ABDECFG。怎么实现这个顺序呢 ?深度优先搜索二叉树是先访问根结点,然后遍历左子树接着是遍历右子树,因此我们可以利用堆栈的先进后出的特 阅读全文
posted @ 2016-05-14 16:54 zhangbaochong 阅读(78120) 评论(0) 推荐(4) 编辑