码迷,mamicode.com
首页 >  
搜索关键字:symmetric    ( 408个结果
LeetCode - Symmetric Tree
关于镜像树的相关操作,利用递归可以很简单的解决问题。 注意判断根节点是不是null/** * Definition for binary tree * public class TreeNode { * int val; * TreeNode left; * TreeNod...
分类:其他好文   时间:2015-04-25 22:28:50    阅读次数:180
leetcode || 101、Symmetric Tree
problem: 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 ...
分类:其他好文   时间:2015-04-20 11:16:24    阅读次数:209
LeetCode --- 101. Symmetric Tree
题目链接:Symmetric Tree 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 ...
分类:其他好文   时间:2015-04-16 09:06:02    阅读次数:147
linux设备驱动第五篇:驱动中的并发与竟态
在上一篇介绍了linux驱动的调试方法,这一篇介绍一下在驱动编程中会遇到的并发和竟态以及如何处理并发和竞争。 首先什么是并发与竟态呢?并发(concurrency)指的是多个执行单元同时、并行被执行。而并发的执行单元对共享资源(硬件资源和软件上的全局、静态变量)的访问则容易导致竞态(race conditions)。可能导致并发和竟态的情况有: SMP(Symmetric Multi-Pr...
分类:系统相关   时间:2015-04-11 14:55:06    阅读次数:257
[LeetCode]Symmetric Tree
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...
分类:其他好文   时间:2015-04-09 21:57:21    阅读次数:131
leetcode:Symmetric Tree
/** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */ class Solutio...
分类:其他好文   时间:2015-04-05 09:04:00    阅读次数:134
leetcode_num101_Symmetric Tree
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 f...
分类:其他好文   时间:2015-04-04 23:50:46    阅读次数:338
LeetCode - Symmetric Tree
问题:判断二叉树是否为镜像二叉树分析:递归判断,根节点单独判断,然后递归左结点和右结点,之后每次一起递归左结点的左结点和右结点的右结点比较,左结点的右结点和右结点的左结点比较。 1 /** 2 * Definition for binary tree 3 * struct TreeNode { .....
分类:其他好文   时间:2015-04-03 00:11:45    阅读次数:198
leetCode 101-Symmetric Tree
链接:https://leetcode.com/problems/symmetric-tree/ 此题就是判断一棵二叉树是否为对称二叉树,刚开始以为中序遍历输出,然后看是否是为回文字串,但是这种思路是错了,如[1,2,3,#,3,#,2]. 代码如下: 通过循环递归判断左孩子的左子树与右孩子的右子树 及 左孩子的右子树与右孩子的左子树即可得到结果。 class Solution { pub...
分类:其他好文   时间:2015-04-02 18:52:21    阅读次数:143
LeetCode-101 Symmetric Tree
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 / \ ...
分类:其他好文   时间:2015-03-29 00:30:42    阅读次数:154
408条   上一页 1 ... 26 27 28 29 30 ... 41 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!