自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(41)
  • 收藏
  • 关注

原创 [2048源码分析-2]游戏主场景

摘要:在这一篇里,阐述

2014-09-07 21:57:32 869

原创 [2048源码分析-1]游戏架构

写在前面:接下来我会逐一介绍一些小游戏的开发,这些小游戏不是我写的,是我找来学习的,都是基于cocos2d-x开发的,有兴趣的朋友可以了解一下.摘要:这一篇主要讲述2048这款游戏的游戏架构,以及开始场景和结束场景的一些介绍.2048这款游戏主要包括以下三个Scene:LoadingScene:加载界面,显示作者等信息的同时异步加载SpriteFrameCache.Game

2014-09-07 20:11:09 1430

原创 [PAT]Battle Over Cities

#include#include#include#includeusing namespace std;class QU//并查集的{ public: QU(int n) { fa=new int[n+2]; for(int i=1;i<=n;i++)fa[i]=i; cou=n; } ~QU() { delete[] fa; }

2014-09-01 10:38:13 532

原创 [Thinking in Java]15.泛型

1.泛型接口与工厂方法相结合.public class CoffeeGeneratorimplements Generator, Iterable { private Class[] types = { Latte.class, Mocha.class, Cappuccino.class, Americano.class, Breve.class, }; private

2014-08-05 11:37:04 575

原创 简化版的LDA源码

package LDA;/** * LDA GibbsSampling * * @author: Liang Yao */public class LDA { int[][] documents; int V; int K; double alpha; double beta; int[][] z; int[][] nw; int[][] nd;

2014-08-04 16:02:21 968 2

原创 [Google]find a,b,c such that a+b+c<=d

Question:Suppose you have a million integer numbers. Return all possible values of a,b and c such that a+b+c d will be provided to you. ex: if the numbers are 1,2,3,4,5,6,7 and d=7 [

2014-07-28 10:42:01 645

原创 [Google]Rearrange White Spaces

Question:Given a string with multiple spaces write a function to in-place trim all spaces leaving a single space between words e.g. _ _ _ Hello _ _ _ World _ _ _ Hello _ World _ _ _ _

2014-07-27 16:38:43 541

原创 [Google]create a Random number generator

Question:create a Random number generator without using the java in build Random class? Solution:

2014-07-27 12:27:09 861

原创 [Google] print the outline of a complete binary tree in anti-clockwise direction

Question:

2014-07-27 00:57:49 563

原创 [Google]Find numbers of nodes in a BST in the range [low,high]

Question:Given a Binary Search tree of integers, you need to return the number of nodes having values between two given integers. You can assume that you already have some extra information at

2014-07-27 00:01:32 617

原创 [Google]maximum n such that the array consists at least n values >=n

Question:Given an unsorted array of integers, you need to return maximum possible n such that the array consists at least n values greater than or equals to n. Array can contain duplicate values. 

2014-07-26 17:53:04 448

原创 [LeetCode]Longest Palindromic Substring

题目描述:

2014-06-30 18:45:03 549

原创 [LeetCode]Rotate List

描述Given a list, rotate the list to the right bykplaces, wherekis non-negative.2.2 单链表 45For example: Given1->2->3->4->5->nullptrandk = 2, return 4->5->1->2->3->nullptr.分析先遍历一遍,得出链表长度len,注意k可能大于len,因此令

2014-06-27 16:52:15 432

原创 [LeetCode]Partition List

描述Given a linked list and a valuex, partition it such that all nodes less than xcome before nodes greaterthan or equal tox.You should preserve the original relative order of the nodes in each

2014-06-27 16:36:45 457

原创 [LeetCode]Reverse Linked List II

描述Reverse a linked list from positionmto n. Do it in-place and in one-pass.For example: Given1->2->3->4->5->nullptr, m= 2 andn= 4,return1->4->3->2->5->nullptr.Note: Given m, n satisfy the foll

2014-06-27 15:59:45 429

原创 [LeetCode]Single Number II

题目描述:Given an array of integers, every element appears three times except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement it with

2014-06-27 15:29:08 511

原创 [LeetCode]Gray Code

题目描述: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 t

2014-06-27 11:27:45 507

原创 [LeetCode]Permutation Sequence

题目描述:The set [1,2,3,…,n] contains a total of n! unique permutations.By listing and labeling all of the permutations in order,We get the following sequence (ie, for n = 3):"123""132""21

2014-06-27 10:38:29 865

原创 [LeetCode] Next Permutation

题目描述Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.If such arrangement is not possible, it must rearrange it as the lowes

2014-06-26 23:35:23 727

原创 [LeetCode] Longest Consecutive Sequence

题目描述:Given an unsorted array of integers, find the length of the longest consecutive elements sequence.For example,Given [100, 4, 200, 1, 3, 2],The longest consecutive elements sequence is [

2014-06-26 23:05:42 542

原创 [LeetCode]Longest Valid Parentheses

解题思路:

2014-06-23 14:51:57 506

原创 Combination Sum

解题思路:

2014-06-22 23:08:20 395

原创 Trapping Rain Water

解题思路我的解题思路好像是全网目前知道的唯一一个哦~~思考这题时,想到了那道 Candy 题.  那道扫描两遍.这题可不可以也扫描两遍呢?答案是可以的.从左往右以当前bar i 为左bar,直到找比它大的bar j .如果找到,就算出两者的trap water.然后令i:=j,继续搜完.从右往左同理的方式搜寻(其实就是把第一遍的每个bar当做右bar).不过这里

2014-06-22 22:54:32 521

原创 (PAT)1009. Product of Polynomials (25)

#include#include#include#include#include#include#includeusing namespace std;class Pol{public : map coe; Pol operator*(const Pol& pol_b) { Pol pol_c; map::const_iterator it_a=coe.be

2014-01-14 14:51:47 520

原创 (PAT)1008.Elevator

#include#include#include#includeusing namespace std;int main(){ int n; vector vec; int mvUp=6; int mvDown=-4; int stop=5; cin>>n; int k=n; while(k) {

2014-01-10 11:34:27 603

原创 (PAT)1007. Maximum Subsequence Sum

#include#include#include#includeusing namespace std;int main(){ int n; vector numVec; vector maxSumEnd; cin>>n; int k=n; int curSum=0; int maxSum=0; int num;

2014-01-10 11:15:14 544

原创 (PAT)1007. Maximum Subsequence Sum

#include#include#include#includeusing namespace std;class Student{public: string sid; int checkin; int checkout; Student(string id,int m_checkin,int m_checkout):sid(id),checki

2014-01-10 10:15:32 498

原创 (PAT)1005. Spell It Right (20)

#include#include#include using namespace std;int main(){ string eng[10]={"zero","one","two","three","four","five","six","seven","eight","nine"}; string s; cin>>s; int sum=0; f

2014-01-08 22:40:55 564

原创 (PAT)1004.Counting Leaves (30)

核心是个广度优先算法,利用C++的知识可以写的更简洁一点,为了联系C,故用数组代替,自己模拟一下队列以及记录当前层次以及下一层。#include#includeint n,m;int level[100+10];int family[100+10][100+10];int parse(char s[3]){ if(s[0]=='0')return (s[1]-'0');

2014-01-08 18:46:31 690

原创 (PAT)1003. Emergency (25)

#include#include#define INF 1<<10int n,m,so,ta;int cities[500+10][500+10];int teams[500+10];int dist[500+10];int byPass[500+10];int maxTeams[500+10];int difDist[500+10];bool visited[500+10];

2014-01-08 16:15:12 625

原创 ( PAT )1001. A+B Format (20)

#include#includeint main(){ int a; int b; char flag; int remaining; int index=0; char s[10]; scanf("%d %d",&a,&b); remaining=a+b; if(remaining==0) { printf("0"); return 0; } if(

2014-01-07 19:08:45 812

原创 Weka 学习:J48(C4.5)

Before writing:To improve my english,I will write my blog in English. Section One: J48                      J48 is a class to implement C4.5 algorithm.Look at part of the code.In thebuildClass

2013-09-16 22:32:15 1194

原创 Weka学习:LMT--LMT && LMTNode

LMT,没有什么需要讲的,入口函数是public void buildClassifier(Instances data)。里面都是一些初始化,最重要的就是m_tree = new LMTNode(...);m_tree.buildClassifier(filteredData);所以就直入正题,分析LMTNode

2013-09-16 10:46:53 1510

原创 Weka学习:LMT--LogisticBase

这篇文章介绍的是LMT的核心 LogisticBase & LMTNode 。LogisticBase 是基类,可以说大部分的LMT核心功能都在这里实现。我们需要一个一个分析。看核心函数之前,先看几个核心数组。 double[][] trainYs = getYs(m_train); double[][] trainFs = getFs(m_numericDa

2013-09-09 22:49:03 1348

原创 Weka学习:LMT--ResidualModelSelection & ResidualSplit

学习LMT源代码之前,要先看几个类,包括ResidualModelSelection ,ResidualSplit,LMTNode,,LogisticBase,SimpleLinearRegression,这里先介绍ResidualModelSelectionhe和ResidualSplit。下一篇介绍其余的。这两个类联合起来充当分裂节点的作用。先看ResidualSplit。这个类有四个主要

2013-09-09 15:11:36 965

原创 Weka学习 :ADTree

ADTree中主要有两种节点,一种是PreditionNode,一种是SplitNode。weka实现中就对应定义了这两个数据结构。 public class PredictionNode { double value; FastVector children; }value存 a或者b(具体含义请看论文)。children存SplitNode. public abstract

2013-08-19 00:06:13 2732

原创 DataMing Papers:<The alternating decision tree learning algorithm>

因为这篇文章引用的资料暂时还没阅读,因此没有看出这篇文章的高明之处,目前只能把文章的算法简单介绍一下,文章的精髓和意义等看了其他文章之后再来修改。需要继续看的文章: 本文章很多的公式出处来自该文章          Defination of ADTrees:1.A base condition :a boolean predicat e over instances.我的理解

2013-08-18 20:56:55 897

原创 Weka 学习 ID3

ID3算法相对简单,weka的实现也容易理解。首先介绍一下大致算法。算法概述如下。1.选择一种度量(ID3选择的是信息增益),计算每个属性对于该度量的值。2.根据结果选择一个属性进行分支。3.如果每个分支全部属于一个类或者已经没有候选属性。则停止,否则对每个分支进行1,2操作。下面对weka的ID3 class 作介绍,主要涉及到makeTree(Instances data),c

2013-08-15 15:52:54 1500

原创 Weka学习 Apriori算法附二 if(m_car)

看完源码,发现weka作者并没有完全实现参考论文二(>)中所阐述的算法。只是实现了一部分,即CBA-RG(Classification Based on Associations -rule generator)过程,并没有实现关键过程CBA-CB(classifier builder)过程,因此自己实现一下。(未完待续)

2013-05-08 15:58:14 1056

原创 Weka 学习 Apriori 附一 AprioriTID算法

如果看了《Fast Algorithms for Mining Association Rules in Large Databases》,会发现对于 findLargeItemSets 来说,有两种算法。第一种就是Weka用的 apriori,另外一种叫做AprioriTid.两者殊途同归,最后得到相同的结果。往下深究,会发现其实区别仅仅在对新产生的集合每一项的Support更新上面。我下面简单

2013-05-05 00:37:24 2796

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除