- 博客(45)
- 收藏
- 关注
原创 原博客域名更换
据说百度无法爬取github page上的博客 很烦恼 于是把搬到了coding page下 所以博客域名更换为 loveSnowBest’s blog (http://lovesnowbest.site)欢迎来玩~
2018-01-11 15:45:12
753
原创 KMP算法小学生理解
KMP算法小学生理解1.简介看毛片算法可谓无人不知,相比于朴素字符串匹配,kmp算法将时间复杂度从o(N*M)缩减为o(N+M),实在为一大进步。其中N为模式串的长度,M为要从中寻找字符串的长度。概括的来说,我们首先对模式串进行一些列的打表,然后对M字串遍历就可以了。下面详细地讲一下这个kmp 2.kmp详解首先,朴素算法之所以可以被优化,其实是因为在匹配的过程中做了重复运算,举个例子来说把,如果
2017-10-04 15:30:56
444
原创 Data lab(two complements arithmetic)
Data lab(two complements arithmetic)1.bitAndThis is a simple function, we learnt about this in discrete math in the last term. /* * bitAnd - x&y using only ~ and | * Example: bitAnd(6, 5) = 4 *
2017-09-11 22:20:58
642
原创 python图片字符画
how to generate a char picture.1.install pillow. 2.import Image&&import argsparse. argsparse is used for dealing with args,width,height.etc. 3.get_char() functionOur purpose is to get each pixel of
2017-08-24 16:30:30
452
原创 support vector machine简介
support vector machine.第一次了解svm是在Andrew的公开课上,可惜他讲的比较浅,仅仅介绍了一点基础知识,包括一些术语都没有涉及。然而最近在看machine learning in action里面也有一章专门讲svm的,可惜英语不过关只能先找中文的看看然后才能看英文的。。。于是我看了许多关于(不算许多)svm的博客,发现这东西博大精深,可挖的东西很多,特此写下来总结一下,
2017-08-16 12:48:28
608
原创 2017.8.7所感
昨天晚上玩手机完的比较晚,大概3点才睡,今天早上11点才起床。平常9点多差不多就开始看书了。不过想想自己看了这么长时间了也不差这两个小时。其实我私下认为自己够努力了,或者说对自己这个暑假的作息还是比较满意的。可是今天下午由于换电脑要给github添加新的ssh的地址就问樵总一些东西,顺带翻了他的blog。看比自己强的人写的东西总是心怀敬畏的,而这些人却又偏偏写的自己很是谦虚,于是我看完之后感觉自己什
2017-08-08 00:31:05
1579
3
原创 背包问题复习2
背包问题复习21.对于数据量变大的01背包问题题目: 想法:首先这题的size和bag都很大,如果直接用动态规划套原来的模板肯定不行,但是我们发现对于value的值比较小。那么我们不妨反过来想这个问题,我们记录对于选到第n个物品,价值达到j的重量最小的情况。这样最后达到的目标肯定是装的最多的。 code:#include<iostream>#include <memory.h>#defi
2017-08-07 17:01:15
407
原创 背包问题复习
背包问题复习vijos 1025想法:记忆化搜索,或者动态规划都行,基础题。 code: #include<iostream>#include<memory.h>using namespace std;int n,size;int value[105],bag[105];int record[105][1500];int search(int count,int rest){
2017-08-06 17:00:57
1211
原创 python 学习笔记6
learning python notes 6Objected Oriented Programming(senior)1.__slots__In python, we can dynamically bind method or attribute to an instance. e.g. class Student(object): passdef setName(self,name
2017-08-06 14:19:10
261
原创 python 学习笔记5
python learning notes 5ModulePython has many useful modules preparing for us. e.g. sys #!/usr/bin/env python3# -*- coding: utf-8 -*-' plain text '__author__='BetaCZH'import sys # import sys
2017-08-05 21:31:08
232
原创 python 学习笔记4
python learning notes 4functional programming1.high-order functionIn python, we don’t need to worry about elemtype. In other words, if we want a pointer points to a function, it’s won’t bother us to de
2017-08-05 18:01:55
251
原创 贪心算法poj 3617,3069,3253
挑战程序设计竞赛greedy problempoj 3617 Best Cow Line想法:先生成一个反着的字符串,(其实就是从两边开始找)先取出两边相比较小的字符串。当然这里有个问题,就是两边的头一个字符相同时,比较下一个字符,直到比较完整个字串为止,找到较小的那边的第一个字符加上。其实用strcmp就可以很好的解决上面描述的操作。 code: #include <iostream>#in
2017-08-05 15:15:13
358
原创 python 学习笔记3
python learning notesSome senior attributes1.Slicecut a piece of elements from the whole container. sytnax:object[beginIndex endIndex (every x)] this provides us an easy way to get fragment of object
2017-08-04 21:45:15
258
原创 简单任务调度问题(贪心)
simple task scheduling problemToday we will talk about task scheduling problem using greedy thinking. In fact, greedy algorithm is quite uncommon, for most problems in our life can not be solved just b
2017-08-04 20:52:57
2905
原创 python 学习笔记2
python learning notes 2.functionIt’s similiar to c in function. One thing to mention, library function the return value of hex() is a str not a number. So you can do abs() on hex(num). define your own
2017-08-04 16:36:44
258
原创 python 学习笔记
python learning notes 11.list && tuple list is similiar to array in c. But python will check if index is out of range. Also, you can index the last element by using index -1. function: append().
2017-08-04 12:06:50
285
原创 哈希算法简介
introduction to HashTable1.What is hash?HashTable is a kind of map. The search process in hashtable holds o(1) complexity. You may think o(1), that’s impossible, since you need to traversal all the con
2017-08-03 14:15:27
331
原创 约瑟夫问题(动态规划解法)
Josephus problem solution with o(n)1.Description People are standing in a circle waiting to be executed. Counting begins at a specified point in the circle and proceeds around the circle in a speci
2017-08-02 13:09:00
936
原创 快速求解组合数(筛法+快速幂)
a quick way to calculate combinatorial number1.Why we need this method? Anyone who know how to print helloworld is also able to write a code to calculate a combinatorial number. However, the calculati
2017-08-01 13:52:10
733
原创 筛法快速求解素数
sieve methodreference:一般筛法求素数+快速线性筛法求素数1.naive method enum k from 2 to √n, if num % k ,then it’s not a prime 2.normal sieve First, let’s suppose all the nums are prime, from 2 to n. Second, for i=1:
2017-07-31 10:50:19
267
转载 ML之模型评估与选择简介
模型评估与选择1. empirical error && overfitting(经验误差和过拟合)分类错误的样本数占样本总数的比例成为 error rate(错误率) 相应的,分类正确的称为 accuracy(精确度) 对于学习器的实际预测输出和样本的真实输出差异称为 error(误差)training error|empirical error(训练误差|经验误差) 在训练集上的误差g
2017-07-28 12:49:23
404
原创 Machine Learning Notes III
Machine Learning Notes III1.Neural networks The most important thing we should make clear is the map in this neural networks model.Here’s the model-> There’s no doubt that the image above is a qui
2017-07-24 14:41:21
330
原创 Machine Learning Notes II
Machine Learning Notes II1.Classification Focus on Binary classification problem Hypothesis representation using Sigmoid Function,also called logistic function The function looks like this->
2017-07-23 14:49:21
387
原创 Dynamic Memory and Smart Poniters(I)
Dynamic Memory And Smart Pointers(I)In c++,we have static memory for local static objects and class static data members and for variables defined outside any functions(global variables),and stack memor
2017-07-20 19:27:06
265
原创 Machine Learning Notes
Machine Learning Notesthis is the summary courses of ML on cousera by Andrew Ng 1.What is Machine Learning?**Definition:**A computer program is said to learn from experience E with respect to some ta
2017-07-19 13:19:10
405
原创 C++实现vector
c++实现vector申明:本人的vector并非按照STL的内部实现机制实现的,但实现了vector的大部分功能,算是一种对STL的学习吧~ 1.实现的功能 实现了vector的所有类型的构造函数 重载operator =,[] 支持iterator迭代器(可使用ranged for loop) 功能函数实现 erase()push_back()pop_back()clea
2017-07-02 13:00:02
576
原创 Search Algorithm introduction
search algorithmSince in the assignment 7, we have a search problem which is a sudoku, I decided to write something about search algorithm. 1.SummaryWhen it comes to search algorithm, everyone would t
2017-06-05 19:45:34
305
原创 cocos study notes-Scene
cocos study notes-Scenereference: [jellythink](“http://www.jellythink.com/archives/733“)1.create a sceneUsually, we write like this:auto scene=Scene::create();We create a scene by this way and then add
2017-05-04 16:33:22
218
原创 cocos study notes-Sprite
cocos study notes-SpriteReference: [jellythink](“http://www.jellythink.com/archives/742“) 1.Sprite class Sprite is a 2D picture object,which can be defined by using a picture or part of picture.A Spr
2017-05-03 23:18:05
245
原创 Cocos study notes-Menu
cocos study notes-Menureference: jellythink In cocos-2d-x, its menu UI system can be divided to three catageries: MenuItemLabel MenuItemSprite MenuItemToggle Now, let’t talk about them in deta
2017-05-02 22:23:45
247
原创 git study notes
git study notes(2)reference Liao Xuefeng’s blog1.look through the whole versionsLet’s suppose a situation: you modified readme.txt again. And now you have 3 versions in your repository: vertion 1:wrot
2017-04-26 12:59:13
361
原创 Git study notes
Git study notes (1)reference :Liao Xuefeng’s blog 1.preparationFirst,install the git,open git-bush.Then you will see a window like CMD,which means you are succeed.Now, you can write something in this
2017-04-25 23:11:32
359
原创 Cocos-2d-x 学习笔记二(Action篇)
Cocos-2d-x学习笔记二1.Action类 ActionInterval example:Flipx() ActionInstant是瞬时动作类,表示瞬间完成,中间没有动画效果,Flipx()就是它的一个例子,当物体走到障碍物时会有一个转向的过程,这可以通过Flipx的动作效果,以下是code: //创建移动动作ActionInterval *moveto = MoveTo::c
2017-04-12 00:33:56
282
原创 cocos-2d-x学习笔记
Cocos-2dx学习笔记1.create a spritecode: auto player=Sprite::create("player.png",rect(0,0,27,40));player->setPosition(Point(x,y));player->setscale(1.5); //代表显示的倍数this->addChild(player); //讲player添加到背
2017-04-10 16:58:25
561
原创 Essential c++ the third part
essential c++=======================第三章复习========================= - 泛型指针的应用 (genetic iterator) 为了将elemtype拓展到更宽泛的数据类型的范围,而不只仅限于vector和array,更可以使用于list,书中提出可以使用genetic iterator,让使用vector却不以vector的方式呈
2017-03-15 17:59:03
227
原创 essential c++ the second part
essential c++=========================第二章复习====================== - 按引用传递和按指针传递容器的值的区别 需要注意,当传递引用的时候,可直接在parameter中写vector的名字(如vec),但当传递指针的时候需要对容器取地址,故需要在vec前加取址符&。 - 声明inline函数(内联函数) 此操作主要应用于对程序的运
2017-03-12 20:52:53
215
原创 队列入门
队列问题队列,即为先进先出的数据结构,需要设定两个下标指针,一个为front,指向要pop的元素,另一个为rear,指向即将进入的新元素。实现这个数据结构也十分简单,代码省略。但是如果简单的采用线性队列那么之前使用过并被释放的元素位置不能被再次使用(如下) -1 -1 -1 5 7
2017-03-03 16:23:33
425
原创 使用二进制的思想降低时间复杂度
如何使用二进制解决问题正如通过高精度模拟可以获得500位以上的加减乘除运算外,当对于过大范围的运算我们可以将问题转化为二进制从而简便运算,使运算的一部分复杂度由n转化为log(n) - 首先是我们熟知的快速排序,即通过不断得将要排序的数组进行中等划分,进而递归成更小的数组,最后获得一个排序完的数组,qsort()其实就可以实现这个过程,不过手打的话可以更清楚一些。 code void quik
2017-02-25 08:58:35
1040
原创 Essential C++
面向过程的编程风格如何编写函数 都是知道的内容,有个就是在main中终止程序可以用#include的exit()函数 调用函数 这里讲到了原来c里面就提到的东西就是如果调用函数的时候只传递一个数组的话是按值传递的方式,及复制了一个数组过去,此时在该函数中若使用swap并不改变数组的实际顺序。那么就需要按地址传递数组。 当我们调用一个函数的时候,会在内存中建立起一块特殊区域成为程序堆
2017-02-23 18:02:01
390
原创 Essential C++第一章
Essential C++因为这本书是下学期的教科书,寒假借回来还没怎么看,结果3月15号就要还了。。。寒假我到底干了啥。。。所以决定这几天把这本书看一遍,当预习了。第一章 c++编程基础首先基本格式差不多都知道了,解释一下using namespace std,其实std是标准库所驻的命名空间,标准库所提供的东西都被封装在std中,为了避免发生命名冲突问题故需要在一开始就让std的名称曝光,所谓
2017-02-22 18:37:19
290
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人