原创 [Java] Convert Between the Two, String[] and ArrayList

How to convert String[] to ArrayList<String>? String[] arrayOfString = new String[] { "The",

原创 【C++primer學習筆記】第10章 關聯容器

1、創建pair的三種方法 pair<string, string> next_auth; string first, last; cin>>first>>last; //method 1 next_auth = pair<str

原创 【ACM】hdu1421 搬寢室 (簡單DP)

http://acm.hdu.edu.cn/showproblem.php?pid=1421 思路: 用數組a[]來保存初始數據,數組shifts[j][i]表示從一共i個數據中取出j對。 首先要理解與一個物品重量差值最小的一定是與它相

原创 【C++primer學習筆記】第9章 順序容器

1、將一個容器複製給另一個容器時,類型必須匹配:容器類型和元素類型都必須相同。 2、初始化爲一段元素的副本 list <string> slist(svec.begin(), svec.end()); vector<string>:

原创 【Effective C++ 學習筆記】Item1-Item4

【1】 視C++爲一個語言聯邦(View C++ as a federation of languages.) 最初: C with classes 現在: 支持過程形式(procedural)、面向對象形式(object-oriente

原创 【ACM】數組的子數組之和的最大值(二維)

#include<iostream> #define MAX 100 using namespace std;   int A[MAX][MAX]; int PS[MAX][MAX]; //method1 /* 最直接的方法,當然是枚舉每

原创 【the EM algorithm】期望最大化

1. 一些英文簡稱 iid :independently and identically distribute EM :Expectation Maximization 2. EM算法 首先來明確一下我們的目標:我們的目標是在觀察變量X

原创 【Nutch】FetcherJob

同樣的: package org.apache.nutch.fetcher; Job 先看它的Job是個什麼情況: currentJob = new NutchJob(getConf(), "fetch"); /

原创 【C/C++】細節決定成敗

C/C++基本類型和長度 1 byte = 8 bits Type Size 數值範圍 無值型void 0 byte 無值域 布爾型bool     1 byte true   fal

原创 【Nutch】InjectorJob

源碼分析 package org.apache.nutch.crawl; 首先呢,InjectorJob類存在於包org.apache.nutch.crawl內。 public class InjectorJob extends N

原创 【Nutch】GeneratorJob

同樣: package org.apache.nutch.crawl; Job 先從它的Job開始入“眼”: currentJob = new NutchJob(getConf(), "generate: " + getC

原创 【the EM algorithm】自己動手,豐衣足食。

1. 首先,用MATLAB生成符合雙峯正態分佈的隨機數。 r=0.5; mu1=50; sigma1=20; mu2=200; sigma2=20; x=zeros(10000,1); for i=1:10000 r1=rand; x(

原创 【C/C++相關】論程序員寫技術博客的重要性

C++數組的動態分配空間、初始化和釋放空間 參考這裏。 針對於一維數組 動態分配空間(new) const int n = 10; int *array = new int [n]; 初始化(memset) #include <s

原创 【the EM algorithm】Jensen不等式

1. 凸函數 設f 是定義於爲實數的函數,如果對於所有實數x,,那麼f 是凸函數。 當x是向量時,如果Hessian Matrix(海森矩陣)H是半正定的() ,那麼f是凸函數。 如果或者,那麼稱f 是嚴格凸函數。 1.1 半正定矩陣

原创 【Effective C++學習筆記】Item5-Item12

【5】瞭解C++默默編寫並調用哪些函數 (Know what functions C++ silently writes and calls.) 如果你寫下 class Empty { };這樣就好像你寫下這樣的代碼: cla