最短路径的O(ElgV)的解法。
使用邻接表存储图,使用堆操作选取下一个最小路径点。
本题的难度并不在最短路径本身这个算法,而是在于堆的操作:
1 使用双重指针操作堆的节点,可以省去直接复制操作堆节点,提高效率,并且这才是有效操作动态地址数据的方法,不用双重指针,我思考了下,觉得更加不好做。
2 使用一个数组记录当前顶点在堆中的位置,相当于一个hash表了,可以需要的时候,直接从表中查找表...
分类:
其他好文 时间:
2014-06-07 02:03:17
阅读次数:
214
class Solution {
public:
void dfs(vector<vector >&result, vectorcombination, vector&candidates, int kth, int k, int index2add){
// 当前正在确定组合中的第kth个数,将把候选集candidates中index2add索引位的值作为第kth个数加到组合中
combination.push_back(ca...
分类:
其他好文 时间:
2014-06-07 01:21:47
阅读次数:
220
【题目】
Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n).
For example,
S = "ADOBECODEBANC"
T = "ABC"
Minimum window is "BANC".
Note:
If there is no such window in S that covers ...
分类:
其他好文 时间:
2014-06-05 11:14:26
阅读次数:
255
最短路
Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 28836 Accepted Submission(s): 12480
Problem Description
在每年的校赛里,所有进入决赛的同学都会获得一件很...
分类:
其他好文 时间:
2014-06-05 10:03:43
阅读次数:
192
【题目】
Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n).
For example,
S = "ADOBECODEBANC"
T = "ABC"
Minimum window is "BANC".
Note:
If there is no such window in S that covers ...
感知器学习算法步骤如下:
1.对权系数w置初值
对权系数w=(W1 .W2 ,…,Wn ,Wn+1 )的各个分量置一个较小的零随机值,但Wn+1 =
—g。并记为Wl (0),W2 (0),…,Wn (0),同时有Wn+1(0)=-θ 。这里Wi (t)为t时刻从第i个
输入上的权系数,i=1,2,…,n。Wn+1 (t)为t时刻时的阀值。
图1-10 感知器的分类例...
分类:
编程语言 时间:
2014-06-05 08:55:11
阅读次数:
448
如果尿布臭了,就换掉它。
1.Duplicated Code 重复代码
Extract MethodPull Up MethodForm Template Method --》 Template Method 模式Substitute Algorithm --》 函数算法替代
2.Long Method 过长的函数
“间接层”所带来的全部利益--解释能力、共享能...
分类:
其他好文 时间:
2014-06-05 08:45:40
阅读次数:
291
题目描述
脱氧核糖核酸即常说的DNA,是一类带有遗传信息的生物大分子。它由4种主要的脱氧核苷酸(dAMP、dGMP、dCMT和dTMP)通过磷酸二酯键连接而成。这4种核苷酸可以分别记为:A、G、C、T。
DNA携带的遗传信息可以用形如:AGGTCGACTCCA.... 的串来表示。DNA在转录复制的过程中可能会发生随机的偏差,这才最终造就了生物的多样性。
为了简化...
分类:
其他好文 时间:
2014-06-05 07:17:23
阅读次数:
295
/*
*Corpyright (c)2013,烟台大学计算机学院
*All right reseved.
*作 者 :曹昕卓 *完成日期:2014年5月28日
*版 本 号:v1.0
*输入描述:
*问题描述:彩票机选
*程序输出:
*问题分析: 还是自己选的放心啊,哈哈!
*算法设计:
*/
#include
#include
#include
using name...
分类:
其他好文 时间:
2014-06-05 06:13:57
阅读次数:
160
Wrote by mutouyun. (http://darkc.at/cxx-type-list/)
群里有个朋友要实现这么一个功能:如何在编译期把一个函数类型的参数减少一个。
简单来说,就是实现下面这个模板:
remove_func_par::type; // type = void(int, long)
根据输入的编译期整数,把函数参数表里对应的参数干掉一个。
为了实现...
分类:
编程语言 时间:
2014-06-05 06:04:09
阅读次数:
273