码迷,mamicode.com
首页 >  
搜索关键字:depth    ( 1433个结果
poj1741 Tree
树分治。 网上有部分人的题解写的啥呀。。。 按重心进行分治。 首先O(n)算出以当前点为根depth(u)+depth(v) #include #include using namespace std; const int maxn = 10000 + 10; const int maxm = 20... ...
分类:其他好文   时间:2016-07-08 16:36:16    阅读次数:131
Linux useful command
查看linux系统里面的各个目录、文件夹的大小和使用情况, 先切换到需要查看的目录,如果需要查看所有linux目录的使用情况就直接切换到系统跟目录,然后执行; du -h --max-depth=1 说明 --max-depth=1 这个参数表示查看文件夹的深度为1,这里要指定,否则如果目录和文件过 ...
分类:系统相关   时间:2016-07-07 17:11:45    阅读次数:167
Using the EventManager
Using the EventManager This tutorial explores the features of zend-eventmanager in-depth. Terminology An Event is a named action. A Listener is any PH ...
分类:其他好文   时间:2016-07-05 11:49:02    阅读次数:192
【一天一道LeetCode】#111. Minimum Depth of Binary Tree
一天一道LeetCode 本系列文章已全部上传至我的github,地址:ZeeCoder‘s Github 欢迎大家关注我的新浪微博,我的新浪微博 欢迎转载,转载请注明出处 (一)题目 Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along t...
分类:其他好文   时间:2016-07-03 19:37:58    阅读次数:92
【一天一道LeetCode】#104. Maximum Depth of Binary Tree
一天一道LeetCode 本系列文章已全部上传至我的github,地址:ZeeCoder‘s Github 欢迎大家关注我的新浪微博,我的新浪微博 欢迎转载,转载请注明出处 (一)题目来源:https://leetcode.com/problems/maximum-depth-of-binary-tree/ Given a binary tree, find its maximu...
分类:其他好文   时间:2016-06-29 11:32:26    阅读次数:185
DFS ( 深度优先/回溯算法 ) 一
深度优先搜索算法(英语:Depth-First-Search,简称DFS)是一种用于遍历或搜索树或图的算法。 沿着树的深度遍历树的节点,尽可能深的搜索树的分支。当节点v的所在边都己被探寻过或者在搜寻时结点不满足条件,搜索将回溯到发现节点v的那条边的起始节点。整个进程反复进行直到所有节点都被访问为止。 ...
分类:编程语言   时间:2016-06-26 21:12:09    阅读次数:249
[LeetCode] Nested List Weight Sum II 嵌套链表权重和之二
Given a nested list of integers, return the sum of all integers in the list weighted by their depth.Each element is either an integer, or a list -- wh ...
分类:其他好文   时间:2016-06-25 00:47:52    阅读次数:254
Minimum Depth of Binary Tree
二叉树的最小深度 采用递归的方式求左右结点的高度,注意判断一个结点是否是叶子结点(左右子树都不存大)。 int minDepth(TreeNode *root) { return minDepth(root, false); } int minDepth(TreeNode *root, bool h ...
分类:其他好文   时间:2016-06-21 14:02:17    阅读次数:125
从排列到组合——深度优先搜索
这个核心代码不超过20行的例子,饱含深度优先搜索(Depth First Search,DFS)的基本模型。理解深度优先搜索的关键在于解决“当下该如何做”。至于“下一步如何做”则与“当下该如何做”是一样的。比如我们这里写的dfs(step)函数的主要功能就是解决当你在用step个盒子的时候你该怎么办。通常的方法就是把每一种可能都去尝试一遍(一般用for循环遍历)。当前这一步解决后便进入下一步dfs(step+1)。下一步的解决方法和当前这一步的解决方法是完全一样的。下面的代码就是深度优先搜索的基本模型。--...
分类:其他好文   时间:2016-06-21 07:15:31    阅读次数:178
104. Maximum Depth of Binary Tree
题目: 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 farthe ...
分类:其他好文   时间:2016-06-19 01:16:46    阅读次数:158
1433条   上一页 1 ... 71 72 73 74 75 ... 144 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!