1 /** 2 * Definition for binary tree 3 * struct TreeNode { 4 * int val; 5 * TreeNode *left; 6 * TreeNode *right; 7 * TreeNode(i...
分类:
其他好文 时间:
2014-11-05 14:42:43
阅读次数:
179
题目描述:
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
...
分类:
其他好文 时间:
2014-11-04 17:24:06
阅读次数:
132
看了一下数据结构中树的操作,A这题感觉好一点了。Symmetric Tree和这个很相似来着,可以借鉴一下这个思路。用递归处理Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that ...
分类:
其他好文 时间:
2014-11-03 23:55:42
阅读次数:
184
算法能力一直不好,决定利用晚上和假期时间多做点算法题,动动手,提高自己。大家看到我的水平低还望莫要嘲笑,嘻嘻。 这一题呢是LeetCode上的对称树问题, Given a binary tree, check whether it is a mirror of itself (ie, sym...
分类:
其他好文 时间:
2014-11-02 22:29:08
阅读次数:
231
介绍还有一种平衡二叉树:红黑树(Red Black Tree),红黑树由Rudolf Bayer于1972年发明,当时被称为平衡二叉B树(symmetric binary B-trees),1978年被Leonidas J. Guibas和Robert Sedgewick改成一个比較摩登的名字:红黑...
分类:
其他好文 时间:
2014-10-31 20:36:56
阅读次数:
199
开始做算法题了,从AC率最高的开始做,思路一开始就找到了要用递归,但是细节上有很多需要修炼的,基础还是要打牢固。要判断是否镜像对称,只需要每次判断根节点的左子节点的左、右儿子是否相对应的等于右子节点的右、左儿子,然后递归调用isNodeSymmetric()即可。附上解法:/** * Defini....
分类:
其他好文 时间:
2014-10-28 08:10:11
阅读次数:
135
问题描述:
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 ...
分类:
其他好文 时间:
2014-10-27 21:19:41
阅读次数:
231
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 / \ ...
分类:
其他好文 时间:
2014-10-26 15:33:29
阅读次数:
141
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 / \ ...
分类:
其他好文 时间:
2014-10-26 11:37:08
阅读次数:
195
考 虑到UDP的无状态特性,目前针对其的NAT实现大致可分为Full Cone、Restricted Cone、Port Restricted Cone和Symmetric NAT四种。值得指出的是,对于TCP协议而言,一般来说,目前NAT中针对TCP的实现基本上是一致的,其间并不存在太大差异,这是...
分类:
其他好文 时间:
2014-10-24 16:23:13
阅读次数:
213