Time of Update: 2018-12-04
老樣子,跟著演算法導論走.//graphRepresentAsAdjacentList.h -- graph header file.//2011-09-02-19.38 -- 2011-09-02-21.47//Purpose://Define a class "graphRepresentAsAdjacentList".//Declare methods of the class, and define element member.#include <iostream>#
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
//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
//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
一晃,好幾天都沒有研究<<ITA>>了.說真的,挺難受.我很喜歡研究演算法問題,之後寫代碼.會寫得很入神.而且,這東西很受我器重. 話鋒一轉,我沒有那麼多時間細細地扣.起碼是現在.最近一直在把主要的時間和精力放在了那本<<Windows 程式設計(五)>>上.進度也很快,很令我欣慰. 說回來,感覺啊.我平時說話真的不講什麼條理,除非跟亮子掰扯道理的時候,其餘的時候,並不怎麼強調邏輯性.是嗎?你說是嗎?我說是.沒有好像,我要避免這個詞.
Time of Update: 2018-12-04
這個東西,是新學的.上一本書雖然有學過圖,但是,這個問題還是沒有學到,這一次,學到了.前前後後2天,寫出來了. 最近的主要精力在C++與<<Windows via>> 還有 線性代數,演算法的東西實在是前進得不多. 還好,通過今天上午的努力,知道自己的腦袋,還沒有退化.真的,每次實現了一個演算法,都興奮得不得了,確實啊,呵呵.//graph.cpp#include "stdafx.h"#include
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
這東西,昨天寫的.比較欣賞的地方就是,原地實現了迴圈隊列.很清晰,很好的思想./*12-34-11-04-05-19.32.c -- 第十二章第三十四題*/#include "PairingHeap.h"static Node * combineSiblings_P (Node * firstSibling){static Node * treeArray[MAXSIBLINGS] ;static Node * first, * second ;int numSiblings ;int
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
看<<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
用了類模板,不知是不是多此一舉,反正練習為主.//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 off.#ifndef
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 * *
Time of Update: 2018-12-04
//graph.cpp -- implement file.//2011-09-25-14.31 -- 2011-09-25-15.58//2011-09-25-18.16 -- 2011-09-25-20.00//2011-09-26-17.20 -- 2011-09-26-18.04//2011-09-26-19.19 -- 2011-09-26-20.00//2011-09-27-09.06 -- 2011-09-27-09.57template<class T>void
Time of Update: 2018-12-04
最大流演算法.在有向圖上啟動並執行演算法.在出現演算法介紹之前,先給出了各種概念.殘餘網路,增廣路徑,割.實現很直觀,用到了廣度優先搜尋.O(VE)的已耗用時間. 演算法的分析與證明我沒有關注,呵呵.//Edmonds-Karp.cpp#include "stdafx.h"#include "graph.h"#include <iostream>#include <vector>using std ::vector ;typedef int T ;const