码迷,mamicode.com
首页 >  
搜索关键字:binarytree    ( 134个结果
LeetCode102 Binary Tree Level Order Traversal Java题解
题解: Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level). For example: Given binary tree {3,9,20,#,#,15,7}, 3 / 9...
分类:编程语言   时间:2015-07-07 09:39:22    阅读次数:109
LeetCode107 Binary Tree Level Order Traversal II
题目: Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root). For example: Given binary tree {3,9,20,#,...
分类:其他好文   时间:2015-07-07 09:38:19    阅读次数:127
LeetCode100 SameTree java题解
题目: Given two binary trees, write a function to check if they are equal or not. Two binary trees are considered equal if they are structurally identical and the nodes have the same value. 解题:...
分类:编程语言   时间:2015-07-06 21:49:34    阅读次数:132
LeetCode101 SynmetricTree Java题解
题目: 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-07-06 21:48:44    阅读次数:139
LeetCode226 InvertBinaryTree Java题解
题目: Invert a binary tree. 4 / 2 7 / \ / 1 3 6 9 to 4 / 7 2 / \ / 9 6 3 1 解答: 遍历每一个节点  直接交换他们的左右节点 代码: public static TreeNode invertTr...
分类:编程语言   时间:2015-07-06 17:57:58    阅读次数:163
LeetCode111 MinmumDepthofBinaryTree java 题解
题目: Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node. 解题: 求根节点到最近的叶子节点之间的距离 用...
分类:编程语言   时间:2015-07-06 16:08:36    阅读次数:152
LeetCode104_MaximumDepthofBinaryTree Java题解
题目: Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node. 解题: 求最大深度  和前面一题类似  用递归遍历就...
分类:编程语言   时间:2015-07-06 16:06:14    阅读次数:143
Java实现链式存储的二叉树
二叉树的定义: 二叉树(BinaryTree)是n(n≥0)个结点的有限集,它或者是空集(n=0),或者由一个根结点及两棵互不相交的、分别称作这个根的左子树和右子树的二叉树组成。 二叉树的遍历方式主要有:先序遍历(NLR),中序遍历(LNR),后序遍历(LRN),和层次遍历。 注意: ...
分类:编程语言   时间:2015-07-02 20:57:24    阅读次数:154
【BUAA 591】The Last Alpha Star
【BUAA 591】The Last Alpha Star 二叉树...
分类:其他好文   时间:2015-06-20 17:08:11    阅读次数:106
递归二叉树建立和遍历及深度计算
上篇咱们说到二叉树的一种建立方法及三种遍历方法的递归非递归算法。这篇换了一种新的建立方法,用先根遍历递归的思路建立二叉树,用递归的方法计算深度,用中根递归和非递归方法遍历整个二叉树。 BinaryTree.h //二叉树的建立和遍历 #ifndef BINARYTREE_H_ #define BINARYTREE_H_ #include typedef int T; struct Node ...
分类:其他好文   时间:2015-06-10 09:04:51    阅读次数:160
134条   上一页 1 ... 8 9 10 11 12 ... 14 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!