码迷,mamicode.com
首页 >  
搜索关键字:minimal ratio tree    ( 19189个结果
LeetCode SameTree
/** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(...
分类:其他好文   时间:2014-06-25 18:42:46    阅读次数:172
LeetCode Maximum Depth of Binary Tree
/** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(...
分类:其他好文   时间:2014-06-25 18:40:08    阅读次数:182
2-3 tree使用
The2-3 treeis also a search tree like thebinary search tree, but this tree tries to solve the problem of theunbalanced tree.Imagine that you have a bi...
分类:其他好文   时间:2014-06-25 17:28:52    阅读次数:202
【算法学习】AVL平衡二叉搜索树原理及各项操作编程实现(C++)
AVLTree即(Adelson-Velskii-Landis Tree),是加了额外条件的二叉搜索树。其平衡条件的建立是为了确保整棵树的深度为O(nLogn)。平衡条件是任何节点的左右子树的高度相差不超过1.在下面的代码中,编程实现了AVL树的建立、查找、插入、删除、遍历等操作。采用C++类封装。...
分类:编程语言   时间:2014-06-25 13:32:44    阅读次数:353
机器学习算法的R语言实现(二):决策树算法
1、介绍 ?决策树(decision tree)是一种有监督的机器学习算法,是一个分类算法。在给定训练集的条件下,生成一个自顶而下的决策树,树的根为起点,树的叶子为样本的分类,从根到叶子的路径就是一个样本进行分类的过程。 ?下图为一个决策树的例子,见http://zh.wikipedia.org/w...
分类:其他好文   时间:2014-06-25 13:13:16    阅读次数:172
字符串后缀自动机:Directed Acyclic Word Graph
trie -- suffix tree -- suffix automa 有这么一些应用场景: 即时响应用户输入的AJAX搜索框时, 显示候选列表。 搜索引擎的关键字个数统计。 后缀树(Suffix Tree): 从根到叶子表示一个后缀。 仅仅从这一个简单的描述,我们可以概念上解决下面的几个问题: P:查找字符串o是否在字符串S中 A:若o在S中,则o必然是S的某个后缀...
分类:其他好文   时间:2014-06-25 08:47:36    阅读次数:165
LeetCode: Sum Root to Leaf Numbers [129]
【题目】 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 the total sum of all root-to-leaf numbers. For example, 1 ...
分类:其他好文   时间:2014-06-25 07:32:27    阅读次数:209
POJ 2420 A Star not a Tree? (计算几何-费马点)
题目大意: 求n边形的费马点,即找到一个点使得这个点到n个点的距离之和最小。 解题思路: 三角形也有费马点,三角形费马点是这样定义的:寻找三角形内的一个点,使得三个顶点到该点的距离之和最小。 三角形费马点的做法是: (1)若有一个角大于120度,那么这个角所在的点就是费马点。 (2)若不存在,那么对于三角形ABC,任取两条边(假设AB、AC),向外做等边三角形得到C' 和 A' ,那么AA' 和CC' 的交点就是费马点。 那么对于这题n多边形,我采取的策略完全不同,采用了模拟退火的做法,这种做法相对比...
分类:其他好文   时间:2014-06-25 00:09:27    阅读次数:319
LeetCode: Binary Tree Maximum Path Sum [124]
【题目】 Given a binary tree, find the maximum path sum. The path may start and end at any node in the tree. For example: Given the below binary tree, 1 / 2 3 Return 6. 【题意】 给定一棵二叉树,找出其中路径和最大的路径,然会返回最大路径和。 本题中的路径不是从根节点到叶子节点这样的传统的路...
分类:其他好文   时间:2014-06-24 20:42:59    阅读次数:268
hdoj 1325 Is It A Tree? 【并查集】
做了一上午,终于ac了 wa了一次主要是忘了还有环!!!  主要是运用并查集知识,又复习了一次!! 思路:输入之后找能不能成环,成环就不是,其次还要判断是不是有两个父节点,如果有两个父节点也不是,之后就找相关的祖先就好了; 还要注意:如果只有一个节点,也是树,如果有两个或多个根节点也不是树;如果没有根节点也不是 链接http://acm.hdu.edu.cn/showproblem.php...
分类:其他好文   时间:2014-06-24 17:17:21    阅读次数:155
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!