Given a binary tree, return thelevel ordertraversal of its nodes' values. (ie, from left to right, level by level).For example:Given binary tree{3,9,2...
分类:
其他好文 时间:
2014-09-09 11:32:38
阅读次数:
240
What's the difference between DOM and SAX?DOM creates tree-like representation of the XML document in memory, SAX is event-based.What's the differen.....
分类:
编程语言 时间:
2014-09-09 11:21:18
阅读次数:
237
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 ...
分类:
其他好文 时间:
2014-09-09 10:44:48
阅读次数:
132
首先阅读readme文件,要求
To build the source, edit the Make.defines.* file for your system and set WKDIR to the pathname of the tree containing the source code. Then just run "make".
我的系统环境是Linux的,因此修改....
分类:
其他好文 时间:
2014-09-08 09:38:36
阅读次数:
278
Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.难度70,与Convert Sorted Array to Binary Sear...
分类:
其他好文 时间:
2014-09-08 06:26:16
阅读次数:
263
ModelSelection主要是用于选择合适的列对数据集进行分割,结合上一篇J48的主流程,发现用到的ModelSelection有 C45ModelSelection以及BinC45ModelSelection,先来分析C45ModelSelection。
一、C45ModelSelection
首先作为一个ModelSelection接口,实现的主要方法有两个,分别是select...
分类:
其他好文 时间:
2014-09-07 22:32:55
阅读次数:
311
说说:
做了这么久,终于做到树了。先说下题意,题目给出了两组数,分别是对一棵树的中序遍历和后序遍历。然后要求的是到达根节点的路径和最短的叶子的值。所谓的路径和就是从叶子到根的路径上所有节点的值的和。这无非就是个树的遍历的问题啦。后序序列的最后一个值为子树根,然后再中序序列中找到该节点,然后树就被分成两棵子树了。然后再递归操作就可以了。这里有一点提醒一下,虽然在开始的时候,对于同一棵树,中...
分类:
其他好文 时间:
2014-09-07 21:13:15
阅读次数:
202
递归,dfs这里返回值是一个pair,first表示两个子树的不经过当前root的最大pathsum;second表示两个子树的,以root->left和root->right为路径起始节点的路径的最大值 1 /** 2 * Definition for binary tree 3 * stru.....
分类:
其他好文 时间:
2014-09-07 19:43:15
阅读次数:
195
RB-tree(红黑树)
1.1
简介
RB-tree属于二叉搜索树,即节点的键值一定大于其左孩子节点的键值,小于其右孩子节点的键值。RB-tree还有以下四个特征:
1、 每个节点非黑即红。
2、 根节点为黑色。
3、 如果节点为红,其子节点必须为黑。
4、 任一节点至NULL(即尾端)的任何路径,所含黑节点...
分类:
其他好文 时间:
2014-09-07 17:19:25
阅读次数:
280