2014年(53)
分类: C/C++
2014-12-06 15:30:01
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).
For example, this binary tree is symmetric:
1 / \ 2 2 / \ / \ 3 4 4 3
But the following is not:
1 / \ 2 2 \ \ 3 3
判断一棵树是不是镜像。关于树,直接的想法就是递归,但是这个题目从单个树来看是无法递归的,但是可以用两个树来递归。