2010年9月8日 星期三

單向鍊結串列

離開學校後,幾乎所學的東西都還給老師了,
工作時雖然學到了一些 domain knowledge,
但是沒有了以前的資料結構、演算法做為工具,
寫程式總覺得很空虛,
所以有時間就稍微複習一下以前的資料結構,
範例可能寫得不好,
歡迎大家討論指教。

Linked list 算是最常用到的一個資料結果,就先拿它來做練習吧!
list.h

list.cpp

 main.cpp

Makefile


執行結果:
$ list
->Constructor
Total: 9
 Cassia Gary Louis Kanru Nami Cyt Jane Hank

Delete the node that name is "Cassia"
Total: 8
 Gary Louis Kanru Nami Cyt Jane Hank

Delete the node that name is "Kanru"
Delete the node that name is "Gary"
Total: 6
 Louis Nami Cyt Jane Hank

->Destructor

0 意見: