二叉搜尋樹就地轉雙向鏈表二叉搜尋樹標頭檔C++

 //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

計算有向非循環圖中兩個結點的路徑數C++

   路徑搜尋,搜尋到目標結點的時候算作一條路徑.不會有兩條一致的路徑,但兩條不同的路徑可以有相同的部分.  同樣只是給出了函數定義,貼.//2011-08-19-21.14 -- 2011-08-19-21.36 by Golden_Shadow.//------------------------------------------------------------------------------------int graphRepresentAsAdjacentMatrix ::m_

圖實現檔案C++

 //graphRepresentAsAdjacentList.cpp -- mplement file#include "stdafx.h"#include "graphRepresentAsAdjacentList.h"//Purpose://Define methods of class "graphRepresentAsAdjacentList".//Private methods://---------------------graphRepresentAsAdjacentList :

尋找有向非循環圖中的強連通分支C++

   話說,半年前接觸過這個東西.昨天又接觸,發現書上給的方法很好.去一趟DFS,回來按照去的完成時間,即從後往前再次對轉置了的原圖進行DFS.就是這樣.  話說啊,來到了網吧,沒帶身份證,在二樓跟一群男童在一間屋子...傳完了出去準備晚飯,貌似今天心情突然好起來了.  同樣只是函數定義而已,沒有經過任何演算法的最佳化,完全就是按照主要的思想來進行的.最近演算法東西前進得不多,在看<<via>>,加油咯.貼吧.//2011-08-21-21.15 -- 2011-08-2

泛型隊列標頭檔C++

//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 << "< "

字謎遊戲(b)C語言

  這個版本出爐比較快,還yeah乎著呢,呵呵.  思想,就是,記錄下單詞的所有首碼,這樣可以減少掃描次數.  我的實現方式,建立一個檔案存放所有單詞的所有首碼,之後同單詞一起裝進表中.添加一個指示域來指示表中的字串是單詞還是首碼.之後在主迴圈中先進行單詞判斷,而後進行首碼判斷.如果當前的字串不是單詞並且也未作為首碼出現在表中,那麼就跳出當前方向的迴圈./*5-13(b)-10-28-21.17.c -- 第五章第十三題*/#include <stdio.h>#include

泛型隊列實現檔案C++

 //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>

O(NlgK)問題隊列實現檔案C語言

/*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 =

所有頂點間最短路徑FloydWarshall演算法標頭檔C++

  你看,禁止了合成複製建構函式和合成賦值操作符,這些都是新學的.  其他的,就比較直觀了.//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

單源最短路徑BellmanFord演算法實現檔案C++

 //graphRepresentAsAdjacentList.cpp -- mplement file#include "stdafx.h"#include "graphRepresentAsAdjacentList.h"//Purpose://Define methods of class "graphRepresentAsAdjacentList".//Private methods://---------------------graphRepresentAsAdjacentList :

近親樹實現檔案C++

//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 >

單源最短路徑BellmanFord演算法主常式C++

//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

二元堆積實現檔案C++

   寫得很不效率,這個東西.很多細節,似乎每次寫,都要重新發現.寫出來了,就好啊.//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

區間樹標頭檔C++

  區間樹.同樣是一種在二叉樹的基礎上擴充出來的資料結構.每個結點儲存了區間資訊.  這個常式,主要是為了接下來的東西而寫的.當然了,它本身也是很久價值的.//intervalTree.h -- 區間樹標頭檔#include <iostream>namespace tree{typedef int Item ;typedef struct node{Item min, max ;Item maxOfAll ;int number ;struct node * left, *

有向非循環圖單源點最短路徑C++

   有向非循環圖上的單源點最短路徑演算法,用到了拓撲排序,很好的思想.  給出了用到的函數,貼出來咯.//DAGShortestPathCalculate.cpp -- 2011-09-05-18.35//private methods declare.void m_initializeSingleSource (int sourceVertex) ;int m_distanceBetweenTwoVertexes (int startVertex, int endVertex) ;void

圖標頭檔C++

 //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

區間樹實現檔案C++

//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

泛型隊列驅動常式C++

   看<<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,

最小產生樹prim演算法C++

   以前也寫過,這次看<<ITA>>決定寫一下.總不寫東西的話,腦袋就笨笨了.用到的東西都在前面的圖實現裡.  要說啊,不久之後,用STL+DLL寫出來,呵呵.加油吧.//graph.cpp -- 2011-08-28-21.20#include "stdafx.h"#include "graphRepresentAsAdjacentList.h"#include <iostream>#include <vector>using std

棋盤類標頭檔C++

//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 * *

總頁數: 4314 1 .... 3947 3948 3949 3950 3951 .... 4314 Go to: 前往

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.