码迷,mamicode.com
首页 >  
搜索关键字:tree-depth    ( 17个结果
[C++]LeetCode: 102 Flatten Binary Tree to Linked List (二叉树转前序链表)
题目: Given a binary tree, flatten it to a linked list in-place. For example, Given 1 / 2 5 / \ 3 4 6 The flattened tree should look like: ...
分类:编程语言   时间:2015-01-16 20:58:36    阅读次数:159
[C++]LeetCode: 100 Convert Sorted Array to Binary Search Tree (AVL树)
题目:Given an array where elements are sorted in ascending order, convert it to a height balanced BST. 思路:给出一个排序的数组,如何构造一个平衡二叉查找树?平衡二叉查找树要求任一结点的左右子树的高度差不能超过一,也叫做高度平衡树。如果让我们从一个排序数组中选取一个元素做树的根,我们会选择哪一个...
分类:编程语言   时间:2015-01-16 16:51:25    阅读次数:237
[C++]LeetCode: 94 Sum Root to Leaf Numbers (先序遍历)
题目: Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number. An example is the root-to-leaf path 1->2->3 which represents the number 123. Find...
分类:编程语言   时间:2015-01-14 22:59:16    阅读次数:431
[C++]LeetCode: 91 Path Sum II
题目: Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum. For example: Given the below binary tree and sum = 22, 5 /...
分类:编程语言   时间:2015-01-12 19:24:15    阅读次数:170
[C++]LeetCode: 89 Same Tree
题目: 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. Ans...
分类:编程语言   时间:2015-01-12 16:44:08    阅读次数:216
[C++]LeetCode: 90 Path Sum
题目: Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum. For example: Given the below binary tree a...
分类:编程语言   时间:2015-01-12 16:40:36    阅读次数:221
[Leetcode][Tree][Depth of Binary Tree]
计算树的深度1、minimum depth of binary tree 1 /** 2 * Definition for binary tree 3 * struct TreeNode { 4 * int val; 5 * TreeNode *left; 6 * ...
分类:其他好文   时间:2014-07-07 15:31:40    阅读次数:182
17条   上一页 1 2
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!