![](https://img-blog.csdnimg.cn/20201014180756724.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
树
文章平均质量分 63
macans
止步就是退步
展开
-
binary-tree-preorder-traversal(先序遍历二叉树)
非递归实现二叉树的先序遍历原创 2016-09-25 12:34:05 · 522 阅读 · 0 评论 -
binary-tree-postorder-traversal(后序遍历二叉树)
递归和非递归方法实现二叉树的后序遍历。原创 2016-09-25 12:08:05 · 493 阅读 · 0 评论 -
Minimum Depth of Binary Tree(求二叉树的最小深度)
class Solution {public: int run(TreeNode *root) { if (root==NULL){ return 0; } int l = run(root->left); int r = run(root->right); if (l原创 2016-09-21 21:54:53 · 415 阅读 · 0 评论 -
输出单层结点
对于一棵二叉树,请设计一个算法,创建含有某一深度上所有结点的链表。给定二叉树的根结点指针TreeNode* root,以及链表上结点的深度,请返回一个链表ListNode,代表该深度上所有结点的值,请按树上从左往右的顺序链接,保证深度不超过树的高度,树上结点的值为非负整数且不超过100000。-----------------------------------------原创 2016-10-24 20:43:36 · 413 阅读 · 0 评论 -
二叉树中和为某一值的路径
输入一颗二叉树和一个整数,打印出二叉树中结点值的和为输入整数的所有路径。路径定义为从树的根结点开始往下一直到叶结点所经过的结点形成一条路径。----------------/*struct TreeNode { int val; struct TreeNode *left; struct TreeNode *right; TreeNode(int x) :原创 2016-10-25 16:58:46 · 350 阅读 · 0 评论 -
LeetCode----sum-root-to-leaf-numbers
题目描述Given a binary tree containing digits from0-9only, each root-to-leaf path could represent a number.An example is the root-to-leaf path1->2->3which represents the number123.Find原创 2016-10-16 11:16:34 · 356 阅读 · 0 评论 -
LeetCode----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 bina原创 2016-10-16 11:41:28 · 349 阅读 · 0 评论