- 博客(15)
- 资源 (1)
- 收藏
- 关注
原创 Section 1.3 Barn Reapir
贪心算法,思路不难但在提交过程中发现很多bug: 1.得到需要“切板”的位置后,应该按num排序 2.当M == 1时要特别处理,否则number为空向量,程序异常退出 3.输入牛的位置是无序的,要先按num升序排序 4.当M > C的时候,number个数应该为min(M,C)/*
2016-08-31 14:45:19
339
翻译 Section 1.3 Greedy Algorithm
The basic idea behind greedy algorithms is to build large solutions up from smaller ones. Unlike other approaches, however, greedy algorithms keep only the best solution they find as they go along.
2016-08-29 23:21:22
565
原创 Section 1.2 Name That Number
一个匹配搜索的问题,不过是我第一次写从文件中即时读取即时搜索。 开始的思路是通过input把number转为name,再进行搜索,后来发现这样不仅费时而且浪费空间;于是采用了把data.txt中的name转化为number,依次与input匹配的方法。
2016-08-20 00:07:01
312
原创 Machine Learning--logistic regression
本文参考http://blog.youkuaiyun.com/xiahouzuoxin/article/details/44959205 在此向原作者致谢当y的取值离散时,linear regression algorithm不再适用,而应该选择logistic regression. 下图是logistic function(or sigmoid function):下面是matlab代码:functio
2016-08-18 21:51:02
424
原创 Section 1.2 Transformations
这道搜索题没什么绕弯的地方,把transformation用矩阵位置变换表示,然后一一验证即可。对于#5 combination我写得比较啰嗦: )/*ID: alexyua2PROG: transformLANG: C++*/#include<fstream>using namespace std;ifstream fin("transform.in");ofstream fout("
2016-08-14 22:43:56
233
原创 Section 1.2 Milking Cows
做的第一个模拟时间轴的问题,关键在于search部分的对于t1,t2的不断变化。 也通过这一题学习了algorithm中的sort函数使用。/*ID: alexyua2PROG: milk2LANG: C++*/#include<fstream>#include<algorithm>#include<vector>using namespace std;ifstream fin("
2016-08-14 21:54:13
265
原创 qsort与bsearch学习
排序算法有很多,搜索算法也很多。c语言提供了qsort和bsearch这两个库函数,今天学习了一下,感觉很实用。 下面是测试代码:#include<stdio.h>#include<stdlib.h>#include<time.h>int cmp(const void*,const void*); int main(){ int s[]={3,4,5,6,2,1}; /*参
2016-06-20 20:51:58
352
原创 2016.5.9 新未来-人工智能论坛
今天旷了一节程序设计课(后来同学讲课上没什么重点(笑)),去听了这个人工智能论坛,感觉收获挺多。洪小文博士:计算机科学的角度 Human + Machine = Superman洪院长对人工智能的前景态度乐观,且认为AI威胁论属于未雨绸缪。现今的人工智能,都是建立在Big data和Algorithm之上的,即便AI可以自由地获取各种信息,机器目前(和在未来很长一段时间)也根本不可能自行设计出
2016-05-10 00:42:57
697
OpenMP实现计算pi值和PSRS排序并行计算实验
2019-05-08
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人