標籤

二元樹 (1) 字串常數池 (1) 投資 (3) 每月損益 (37) 例外處理 (1) 泛型 (2) 股票 (15) 指標 (5) 英文 (8) 基本資料型別 (1) 期貨 (1) 程式交易 (10) 量化投資 (5) 亂亂寫 (3) 概念 (3) 資料結構 (3) 演算法 (3) 數學 (3) 轉型 (1) AMA (1) ArrayList (1) assert (1) BeautifulSoup (1) C/C++ (8) casting (1) ClassCastException (1) classpath (1) Collection (4) Comparable (1) comparTo() (1) constructor (1) database (3) Debian (1) Dropbox (2) EA (2) enum (1) equals() (2) exception (3) extends (1) ffmpeg (1) final (1) Git (1) HashMap (1) HashSet (1) hasNext() (1) HTS (3) instanceof (1) IS-A (1) Iterator (1) JAVA (43) length (1) Linux (31) List (1) Mac (6) Map (1) ML (2) MT4 (6) MySQL (2) next() (1) NullPointerException (1) Number (1) Numpy (2) OpenCart (1) OpenCV (3) OSX (1) overloading (1) overriding (3) pandas (2) PHP (8) PriorityQueue (1) Python (11) Queue (1) random() (1) reverse() (1) Samba (1) SCJP (21) sqrt() (1) synchronized (1) talib (1) ufw (1) uTorrent (1) var-args (2) VHF (1) vim (2) Yhoo知識+ (4)

2011年11月10日 星期四

111026_英文_考慮到,顧及到

take into account
考慮到,顧及到


例句:
We must take into account the gain of the antenna.
我們必須考慮到天線增益。


生字:
gain    /gein/    增加,增添
antenna    /ænˋtenə/    天線,觸角

2011年11月5日 星期六

111015_演算法_螞蟻演算法

螞蟻演算法
當蟻群會在巢穴與食物間找到一條最短路徑。

參考:http://iridia.ulb.ac.be/~mdorigo/ACO/index.html

111025_演算法_雙迴圈的時間複雜度

(a)
for(a=1; a<N; a++)
    for(b=1; b<=N; b++)
        c++;
解:
∑a=1N-1∑b=1N 1 
= ∑a=1N-1.N
= N∑a=1N-11  
= N(N-1) 
≈ N2 
∈ O(N2)


(b)
for(a=1; a<N; a++)
    b++;
解:
∑a=1N-1 1 = N-1 ≈ N ∈ O(N)


(c)
for(a=1; a<N; a++)
    for(b=a; b<7; b++)
        c++;
解:
∑a=1N-1∑b=a 6 1 
= ∑a=1N-1(6-a+1) 
= ∑a=1N-1(7-a)      
= 7∑a=1N-11 - ∑a=1N-1a   
= 7(N-1-1+1) - (1+N-1)(N-1)/2
= 7(N-1) - N(N-1)/2
≈ N2
∈ O(N2)     

111024_等差級數之和

一等差級數 S = a1 + a2 + … + an,共n項
其和為 n(a1+an)/2

*要快速記憶的話,就把它想成一個梯形,梯形公式為上底加下底乘以高除2

所以S可以寫成 ∑k=1n ak 表示 a1 + a2 + … + an

2011年11月4日 星期五

111023_JAVA_資料格式化

import java.io.*;


public class stuList {
static String pickName(String a){
a = a.substring(14, 25);
a = a.substring(0,a.indexOf(" "));
return a;
}
public static void main(String[] args) throws Exception {
FileReader liststu = new FileReader("c:\\stuMAIL.txt");
BufferedReader bufferListstu = new BufferedReader(liststu);
FileWriter wrFile = new FileWriter("c:\\output.txt");
BufferedWriter bw = new BufferedWriter(wrFile);

String nameList;
String outNameList;
String num;

while((nameList = bufferListstu.readLine())!=null){
num = nameList.substring(1, 10);
outNameList = num +",,"+ pickName(nameList)
 +","+ num.toLowerCase() +"@ms1.uuu.edu.tw,,,3";
bw.write(outNameList);
bw.newLine();
}
bufferListstu.close();
bw.close();
}


}

把原本的
"D10318002 ","吳XX      ","d10318002@ms1.uuu.edu.tw"
"D10318003 ","歐XX      ","d10318003@ms1.uuu.edu.tw"
"D10318004 ","蔡XX      ","d10318004@ms1.uuu.edu.tw"
...

改成
D10318002,,吳XX,d10318002@ms1.uuu.edu.tw,,,3
D10318003,,歐XX,d10318003@ms1.uuu.edu.tw,,,3
D10318004,,蔡XX,d10318004@ms1.uuu.edu.tw,,,3

111022_JAVA_把字串大小寫變小大寫

String toLowerCase()


例:


String a = "SUPERMAN";
String b = "batman";
System.out.println(a.toLowerCase());
System.out.println(b.toUpperCase());



輸出:

superman
BATMAN

2011年11月3日 星期四

111021_JAVA_從字串中抽取其中一段子字串

String substring(int beginIndex)
例:
String a = "superman";
System.out.println(a.substring(3)); //索引0,1,2不要,從索引3開始抽取


輸出:
erman


String substring(int beginIndex, int endIndex)

例:
String a = "superman";
System.out.println(a.substring(3, 6)); //從索引3抽取到索引6之前(所以索引6的值"a"不取,取至索引5"m"


輸出:
erm


例:

String a = "superman";
System.out.println(a.substring(3, 4)); //從索引3抽取到索引4之前(所以等於只抽取一字元

輸出:
e



圖解:

0 1 2 3 4 5 6 7 8
s u p e r m a n \0