Given an integer, write a function to determine if it is a power of two.Analyse:***Notice that if a number is a power of 2, then the highest binary di...
分类:
其他好文 时间:
2015-08-29 07:27:41
阅读次数:
243
https://leetcode.com/problems/flatten-binary-tree-to-linked-list/二叉树先序遍历,之后做成链表 1 /** 2 * Definition for a binary tree node. 3 * struct TreeNode { 4.....
分类:
其他好文 时间:
2015-08-28 19:32:28
阅读次数:
133
直接用实例来说明序列化和反序列化:namespace DynamicTest{ class Program { static void Main(string[] args) { List list = new List(); ...
Given a binary tree, return all root-to-leaf paths.
For example, given the following binary tree:
1
/ 2 3
5
All root-to-leaf paths are:
["1->2->5", "1->3"]
递归的方法:
publi...
分类:
其他好文 时间:
2015-08-28 17:37:44
阅读次数:
168
决策树(decision trees)
工作原理:
决策树属于监督类型的算法,同样,我们有数据集,知道每一条数据的分类。然后我们按照某种规则,选取数据集上的特征作为分割点,把数据集进行划分。循环重复以上动作,直至所有数据集各自的分类都是唯一的,或者所有特征已经被选择无法再进行划分。使用何种规则进行特征的选取下文将会叙述。
优点:计算复杂度不高,输出结果易于理解,对中间值的缺失...
分类:
其他好文 时间:
2015-08-28 17:37:31
阅读次数:
224
开发中常见错误和警告总结(二十二) 变异方法error:Binary operator '+=' cannot be applied to two int operands上面是一个常见的Switf错误,这个时候我们就要想到变异(mutating),只需要在需要修改外面属性的方法前面添加一个 mut...
分类:
移动开发 时间:
2015-08-28 14:54:29
阅读次数:
191
Given a binary tree, imagine yourself standing on therightside of it, return the values of the nodes you can see ordered from top to bottom.For exampl...
分类:
其他好文 时间:
2015-08-28 13:13:48
阅读次数:
91
题目: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 ...
分类:
其他好文 时间:
2015-08-28 12:45:15
阅读次数:
125
题目:Givenn, how many structurally uniqueBST's(binary search trees) that store values 1...n?For example,Givenn= 3, there are a total of 5 unique BST's. ...
分类:
其他好文 时间:
2015-08-28 12:40:19
阅读次数:
194
Query on The Trees
Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 65768/65768 K (Java/Others)
Total Submission(s): 3602 Accepted Submission(s): 1587
Problem Description
We have me...
分类:
其他好文 时间:
2015-08-28 02:12:39
阅读次数:
199