码迷,mamicode.com
首页 >  
搜索关键字:二叉树.binary tree    ( 18099个结果
LeetCode解题报告:Binary Tree Postorder Traversal
Given a binary tree, return thepostordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[3,2,1].No...
分类:其他好文   时间:2014-06-18 17:32:02    阅读次数:168
[LeetCode OJ] Symmetric Tree
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 / \ ...
分类:其他好文   时间:2014-06-18 13:29:31    阅读次数:214
[LeetCode] 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 farthest le...
分类:其他好文   时间:2014-06-18 12:51:52    阅读次数:205
java实现fp-growth算法
FP Growth算法利用了巧妙的数据结构,大大降低了Aproir挖掘算法的代价,他不需要不断得生成候选项目队列和不断得扫描整个数据库进行比对。为了达到这样的效果,它采用了一种简洁的数据结构,叫做frequent-pattern tree(频繁模式树)。...
分类:编程语言   时间:2014-06-18 12:22:01    阅读次数:495
[数据结构与算法分析(Mark Allen Weiss)]二叉树的插入与删除 @ Python
二叉树的插入与删除,来自Mark Allen Weiss的《数据结构与算法分析》。# Definition for a binary tree nodeclass TreeNode: def __init__(self, x): self.val = x self...
分类:编程语言   时间:2014-06-17 14:25:01    阅读次数:291
机器学习算法的R语言实现(二):决策树
1、介绍 ?决策树(decision tree)是一种有监督的机器学习算法,是一个分类算法。在给定训练集的条件下,生成一个自顶而下的决策树,树的根为起点,树的叶子为样本的分类,从根到叶子的路径就是一个样本进行分类的过程。 ?下图为一个决策树的例子,见http://zh.wikipedia.org/w...
分类:其他好文   时间:2014-06-17 13:17:44    阅读次数:281
leetcode - Binary Tree Preorder Traversal && Binary Tree Inorder Traversal && Binary Tree Postorder Traversal
简单来说,就是二叉树的前序、中序、后序遍历,包括了递归和非递归的方法前序遍历(注释中的为递归版本): 1 #include 2 #include 3 #include 4 #include 5 6 using namespace std; 7 8 struct TreeNode 9 {1...
分类:其他好文   时间:2014-06-17 12:53:42    阅读次数:416
《python源码剖析》笔记 python中的Dict对象
1.PyDictObject对象 --> C++ STL中的map是基于RB-tree的,搜索时间复杂度是O(logN) PyDictObject采用了hash表,时间复杂度是O(1) typedef struct{ Py_ssize_t me_hash; //me_key的hash值,避免每次查询都要重新计算一遍hash值 PyObject *me_key; PyObject *me_value; }PyDictEntry; 将(key,value)对称为entry,它可以在3种状态...
分类:编程语言   时间:2014-06-16 21:22:45    阅读次数:272
seach tree的deletion的实现——对树的指针的进一步理解
一颗binarysearchtree,我们要在其中删除node1。而node1对应的key是,比如说,key1.删除的基本想法是什么呢?1.找到key1对应的那个node在哪里。这个用一个迭代就可以完成了。2.删掉这个node(1)如果这个node没有左右子树,那么直接删掉就好了。(2)如果这个node只有左子树或..
分类:其他好文   时间:2014-06-16 18:32:13    阅读次数:270
Tree的学习
demo代码如下。欢迎指正与讨论。#include<iostream> #include<queue> #include<stack> usingnamespacestd; template<typenameT> structBinaryNode{ Telem; BinaryNode*left; BinaryNode*right; BinaryNode(Td,BinaryNode*l=NULL,BinaryNode*r=NUL..
分类:其他好文   时间:2014-06-16 16:35:05    阅读次数:278
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!