二叉查找树一般采用二叉链表作为其存储结构,我们这次也采用这样的实现。二叉查找树一般有查找、插入和删除等操作,其中查找是基础,没有查找,插入和删除则无从谈起;而删除算是难点,需处理四种不同的情况,分别是:
无左右孩子,(采取直接删除,须处理其父节点指针)
只有左孩子,(采取其父节点指针指向其左孩子)
只有右孩子、(采取其父节点指针指向其右孩子)
左右孩子都存在,(采取以直接前驱或直接后继代替...
分类:
其他好文 时间:
2014-06-03 00:35:52
阅读次数:
254
Logistic回归主要用于医学中对流行病分析,或者对某种疾病的危险因素分析。通常用于二分类,也就是说因变量
只有两个,当然也可以用于多分类。
Logistic回归的理论内容上篇文章已经讲述过,在求解参数时可以用牛顿迭代,可以发现这种方法貌似
太复杂,今天我们介绍另一种方法,叫梯度下降。当然求最小值就是梯度下降,而求最大值相对就是梯度上升。
在Logistic回归中,由于,如果...
分类:
其他好文 时间:
2014-06-03 00:06:19
阅读次数:
353
实现当前日历的打印,当前日期用*来表示。
关键得出这个月的第一天是星期几。
基姆拉尔森计算公式
W= (d+2*m+3*(m+1)/5+y+y/4-y/100+y/400) mod 7
在公式中d表示日期中的日数+1,m表示月份数,y表示年数。
注意1:在公式中有个与其他公式不同的地方:
把一月和二月看成是上一年的十三月和十四月,
例:如果是2004-1-1...
分类:
编程语言 时间:
2014-06-02 23:54:36
阅读次数:
458
1、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 leaf node.
clas...
分类:
其他好文 时间:
2014-06-02 23:13:22
阅读次数:
290
1.vertica概念
面向数据分析的数据仓库系统解决方案
2.vertica关键特性
Ø 标准的SQL接口:可以利用已有的BI、ETL、Hadoop/MapReduce和OLTP环境
Ø 高可用:内置的冗余也提升了查询速度
Ø 自动化数据库设计:数据库自动安装、优化、管理
Ø 高级压缩:十多种压缩算法最多可节省90%的空间
Ø 大规模并行处理:运行于低成本的x86型Lin...
分类:
其他好文 时间:
2014-06-02 23:09:24
阅读次数:
483
这是一个静态插值算法的效果,图形学中插值算法应用十分广,如动画,photoshop, autocAD等软件画曲线,还有shader中的渐变上色也是一个硬件支持的插值算法。
Interpolation是很低层的算法,在图形学中可以说无处不在。
本程序通过设置两个vector,然后就可以在这两个vector之间插入点,得到不同的效果
如两个vector不同长度可以得到:
如果长...
分类:
其他好文 时间:
2014-06-01 10:54:54
阅读次数:
260
课程介绍
这门课程核心内容是算法和数据结构。
具体的算法和数据结构如下:
数据类型:堆栈、队列、背包、并查集、优先队列。
排序:快排、并排、堆排、基数排序
查找:BST、红黑BST、哈希表
图:BFS、DFS、Prim、Kruskai、Dijkstra
字符串:KMP、正则、TST、哈夫曼、LZW
高级:B树、后缀数组、最...
分类:
其他好文 时间:
2014-06-01 10:52:26
阅读次数:
285
【题目】
Given n non-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in the histogram.
Above is a histogram where width of each bar is 1, given height = [2,1,5,6,2,3].
The...
分类:
其他好文 时间:
2014-06-01 10:46:29
阅读次数:
242
【题目】
The gray code is a binary numeral system where two successive values differ in only one bit.
Given a non-negative integer n representing the total number of bits in the code, print the sequence of gray code. A gray code sequence must begin with 0.
...
分类:
其他好文 时间:
2014-06-01 09:16:29
阅读次数:
242
Given a linked list, reverse the nodes of a linked list k at a time and return its modified list.
If the number of nodes is not a multiple of k then left-out nodes in the end should remain as it is...
分类:
其他好文 时间:
2014-06-01 09:05:42
阅读次数:
271