Time of Update: 2018-12-04
//binarySearchTree.h -- 2011-07-27-17.14class binarySearchTree{public:enum direction {Direction_Left, Direction_Right} ;typedef int Item ;typedef struct node{Item item ;struct node * left, * right ;} Node ;private:Node * m_root ;int m_current ;Node
Time of Update: 2018-12-04
路徑搜尋,搜尋到目標結點的時候算作一條路徑.不會有兩條一致的路徑,但兩條不同的路徑可以有相同的部分. 同樣只是給出了函數定義,貼.//2011-08-19-21.14 -- 2011-08-19-21.36 by Golden_Shadow.//------------------------------------------------------------------------------------int graphRepresentAsAdjacentMatrix ::m_
Time of Update: 2018-12-04
//graphRepresentAsAdjacentList.cpp -- mplement file#include "stdafx.h"#include "graphRepresentAsAdjacentList.h"//Purpose://Define methods of class "graphRepresentAsAdjacentList".//Private methods://---------------------graphRepresentAsAdjacentList :
Time of Update: 2018-12-04
話說,半年前接觸過這個東西.昨天又接觸,發現書上給的方法很好.去一趟DFS,回來按照去的完成時間,即從後往前再次對轉置了的原圖進行DFS.就是這樣. 話說啊,來到了網吧,沒帶身份證,在二樓跟一群男童在一間屋子...傳完了出去準備晚飯,貌似今天心情突然好起來了. 同樣只是函數定義而已,沒有經過任何演算法的最佳化,完全就是按照主要的思想來進行的.最近演算法東西前進得不多,在看<<via>>,加油咯.貼吧.//2011-08-21-21.15 -- 2011-08-2
Time of Update: 2018-12-04
//queue.h#ifndef QUEUE_H_#define QUEUE_H_#include <iostream>template<class T>class Queue ;template<class T>std ::ostream & operator << (std ::ostream & os, const Queue<T> & queue){os << "< "
Time of Update: 2018-12-04
這個版本出爐比較快,還yeah乎著呢,呵呵. 思想,就是,記錄下單詞的所有首碼,這樣可以減少掃描次數. 我的實現方式,建立一個檔案存放所有單詞的所有首碼,之後同單詞一起裝進表中.添加一個指示域來指示表中的字串是單詞還是首碼.之後在主迴圈中先進行單詞判斷,而後進行首碼判斷.如果當前的字串不是單詞並且也未作為首碼出現在表中,那麼就跳出當前方向的迴圈./*5-13(b)-10-28-21.17.c -- 第五章第十三題*/#include <stdio.h>#include
Time of Update: 2018-12-04
//queue.cpptemplate<class T>void Queue<T> ::m_copyElement (const Queue &queue){QueueItem<T> * scan = queue.m_head ;while (scan != NULL){push(scan ->m_item) ;scan = scan ->m_next ;}}template<class T>
Time of Update: 2018-12-04
/*Queue.c -- 隊列實現檔案*/#include "Queue.h"/*局部函式宣告*/static QueueNode * makeNode_Q (const Item item) ;/*介面函數定義*/BOOL Initialize_Q (Queue * const pq){*pq = (struct queue *) malloc (sizeof (struct queue)) ;if (NULL == *pq)return FALSE ;(*pq) -> front =
Time of Update: 2018-12-04
你看,禁止了合成複製建構函式和合成賦值操作符,這些都是新學的. 其他的,就比較直觀了.//graphRepresentAsAdjacentMatrix.h --graph header file.//Purpose://A graph represent as a adjacent matrix, this graph can't storage //weight value instead of true or false means m_matrix[i][j] is on or
Time of Update: 2018-12-04
//graphRepresentAsAdjacentList.cpp -- mplement file#include "stdafx.h"#include "graphRepresentAsAdjacentList.h"//Purpose://Define methods of class "graphRepresentAsAdjacentList".//Private methods://---------------------graphRepresentAsAdjacentList :
Time of Update: 2018-12-04
//nearTree.cpp -- 近親樹實現檔案#include "stdafx.h"#include "nearTree.h"namespace tree{//private:int NearTree :: m_Min (const int a, const int b, const int c, const int d) const{int min = a ;if (min > b)min = b ;if (min > c)min = c ;if (min >
Time of Update: 2018-12-04
//graph.cpp -- 2011-09-02-21.20#include "stdafx.h"#include "graphRepresentAsAdjacentList.h"#include <iostream>#include <vector>const int Size = 5 ;using std ::vector ;int _tmain(int argc, _TCHAR* argv[]){vector<int> indexV
Time of Update: 2018-12-04
寫得很不效率,這個東西.很多細節,似乎每次寫,都要重新發現.寫出來了,就好啊.//binaryHeap.cpp -- 2011-08-28-23.06//Purpose://Define methods of class "binaryHeap".#include "stdafx.h"#include "binaryHeap.h"//Private methods://---------------------void binaryHeap ::m_percolateUp (int
Time of Update: 2018-12-04
區間樹.同樣是一種在二叉樹的基礎上擴充出來的資料結構.每個結點儲存了區間資訊. 這個常式,主要是為了接下來的東西而寫的.當然了,它本身也是很久價值的.//intervalTree.h -- 區間樹標頭檔#include <iostream>namespace tree{typedef int Item ;typedef struct node{Item min, max ;Item maxOfAll ;int number ;struct node * left, *
Time of Update: 2018-12-04
有向非循環圖上的單源點最短路徑演算法,用到了拓撲排序,很好的思想. 給出了用到的函數,貼出來咯.//DAGShortestPathCalculate.cpp -- 2011-09-05-18.35//private methods declare.void m_initializeSingleSource (int sourceVertex) ;int m_distanceBetweenTwoVertexes (int startVertex, int endVertex) ;void
Time of Update: 2018-12-04
//graphRepresentAsAdjacentList.h -- graph header file.//2011-08-28-20.26 -- //Purpose://Define a class "graphRepresentAsAdjacentList".//Declare methods of the class, and define element member.#include <iostream>#include <vector>#include
Time of Update: 2018-12-04
//intervalTree.cpp -- 區間樹實現檔案#include "stdafx.h"#include "intervalTree.h"namespace tree{//private:bool IntervalTree :: m_Overlap (const Item min, const Item max) const{if (m_min <= max){if (min <= m_max)return true ;elsereturn false
Time of Update: 2018-12-04
看<<C++ Primer>>看到的,這東西,內容是真多,慢慢看吧,也快看完了.最近兩天籌備一周年的文章了,希望能有些技術含量,期待吧.都要我去做,呵呵,我完全可以.// testMyself.cpp -- 2011-09-24-15.19#include "stdafx.h"#include "queue.h"const int Size = 10 ;int _tmain(int argc, _TCHAR* argv[]){int arr[Size] = {1,
Time of Update: 2018-12-04
以前也寫過,這次看<<ITA>>決定寫一下.總不寫東西的話,腦袋就笨笨了.用到的東西都在前面的圖實現裡. 要說啊,不久之後,用STL+DLL寫出來,呵呵.加油吧.//graph.cpp -- 2011-08-28-21.20#include "stdafx.h"#include "graphRepresentAsAdjacentList.h"#include <iostream>#include <vector>using std
Time of Update: 2018-12-04
//Chessboard.h#include <iostream>#include <cstdlib>#include <ctime>#include "Chessman.h"//Ignore examining parameter and error.class Chessboard: private Chessman{private:Chessman * * m_chessboard ;m_Direction * *