freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

測(cè)繪軟件實(shí)習(xí)報(bào)告(已修改)

2025-01-31 00:24 本頁(yè)面
 

【正文】 中國(guó)礦業(yè)大學(xué)測(cè)繪軟件設(shè)計(jì)與實(shí)現(xiàn)實(shí)驗(yàn)報(bào)告學(xué)  號(hào):     姓  名:     班  級(jí):  指導(dǎo)教師:  王永波  實(shí)驗(yàn)一 二叉樹(shù)的構(gòu)建及其遍歷算法的實(shí)現(xiàn)實(shí)驗(yàn)?zāi)康模和瓿啥鏄?shù)的構(gòu)建以及二叉樹(shù)的遍歷等,加深對(duì)樹(shù)以及二叉樹(shù)的遍歷相關(guān)知識(shí)的理解。實(shí)驗(yàn)內(nèi)容:。、中序、后序遍歷。主要代碼:template class Tclass C_LJH_BinTree { public: C_LJH_BinTree()。//構(gòu)造函數(shù),根據(jù)輸入前序序列由鍵盤(pán)輸入 ~C_LJH_BinTree()。//析構(gòu)函數(shù) void PreOrder()。//前序遍歷 void InOrder()。//中序遍歷 void PostOrder()。//后序遍歷 private: T data。 C_LJH_BinTreeT *lchild,*rchild。 bool NO_Die。}。 template class T C_LJH_BinTreeT::C_LJH_BinTree() { NO_Die = false。 lchild = NULL。 rchild = NULL。 char ch。 cinch。 if (ch == 39。39。) { NO_Die = true。//若為,代表空節(jié)點(diǎn) } else { thisdata = ch。//保存輸入的節(jié)點(diǎn) //左子樹(shù) C_LJH_BinTree *newChild0 = new C_LJH_BinTreeT()。 if (newChild0NO_Die) delete newChild0。 else thislchild= newChild0。 //右子樹(shù) C_LJH_BinTree *newChild1 = new C_LJH_BinTreeT()。//直接創(chuàng)建子節(jié)點(diǎn), if (newChild1NO_Die) delete newChild1。 else thisrchild= newChild1。 } } //析構(gòu)函數(shù) template class T C_LJH_BinTreeT::~C_LJH_BinTree() { if (lchild) delete lchild。 //刪除父節(jié)點(diǎn)之前,先刪除子節(jié)點(diǎn) if (rchild) delete rchild。 } //前序遍歷 template class T void C_LJH_BinTreeT::PreOrder() { coutthisdata\t。//先輸出父節(jié)點(diǎn),然后子節(jié)點(diǎn)按照父節(jié)點(diǎn)做 if (lchild!=NULL) thislchildPreOrder()。 if (rchild!=NULL) thisrchildPreOrder()。 } //中序遍歷 template class T void C_LJH_BinTreeT::InOrder() { if (lchild) lchildInOrder()。 coutthisdata\t。 if (rchild) rchildInOrder()。 } //后序遍歷 template class T void C_LJH_BinTreeT::PostOrder() { if (lchild) lchildPostOrder()。 if (rchild) rchildPostOrder()。 coutthisdata\t。 } int main() { cout請(qǐng)輸入二叉樹(shù)的前序遍歷:endl。 cout(以作為分支結(jié)尾,例如:A B C )endl。 C_LJH_BinTreechar m_tree。 coutendl。 cout前序遍歷為:endl。 ()。 coutendl。 cout中序遍歷為:endl。 ()。 coutendl。 cout后序遍歷為:endl。 ()。 coutendl。 return 0。 }實(shí)驗(yàn)結(jié)果:實(shí)驗(yàn)體會(huì):通過(guò)本次試驗(yàn),理解了二叉樹(shù)類(lèi)的構(gòu)建、二叉樹(shù)的建立及其遍歷。作為第一次實(shí)驗(yàn),內(nèi)容上實(shí)現(xiàn)實(shí)驗(yàn)所要求的目沒(méi)有多大的難處,但其從數(shù)據(jù)結(jié)構(gòu)出發(fā),讓我回憶起很多以前學(xué)過(guò)的知識(shí),對(duì)我來(lái)說(shuō),收獲不少。實(shí)驗(yàn)二 圖的創(chuàng)建、遍歷及其MST的構(gòu)建實(shí)驗(yàn)?zāi)康模和瓿蓤D的創(chuàng)建、遍歷及最小數(shù)的構(gòu)建,加深對(duì)圖的認(rèn)識(shí)以及對(duì)相關(guān)課本知識(shí)的認(rèn)識(shí)。實(shí)驗(yàn)內(nèi)容: 。 。 。 。主要代碼:struct primnode{public: char begvex。//開(kāi)始結(jié)點(diǎn) char endvex。//結(jié)束結(jié)點(diǎn) int lowcost。//中間權(quán)值}。class LJH_Graphmtx//圖的鄰接矩陣定義{ public: LJH_Graphmtx(int sz=DefaultVertices)。//構(gòu)造函數(shù) ~LJH_Graphmtx()//析構(gòu)函數(shù) {delete []VerticesList。delete []Edge。} bool GraphEmpty()//判斷圖是否為空 { if(numEdges==0)return true。 else return false。 } bool GraphFull()//判斷圖是否為滿(mǎn) {if(numVertices==maxVertices||numEdges==maxVertices*(maxVertices1)/2) return true。 else return false。 }int NumberOfVertices()//返回當(dāng)前頂點(diǎn)數(shù) { return numVertices。 } int NumberOfEdges()//返回當(dāng)前邊數(shù) { return numEdges。 } char getValue(int i)//取頂點(diǎn)i的值,i不合理返回0 { return i=0amp。amp。i=numVertices ? VerticesList[i] : NULL。 } int getWeight(int v1,int v2)//取邊(v1,v2)上的權(quán)值 { return v1!=1amp。amp。v2!=1 ? Edge[v1][v2] : 0。 } int getFirstNeighbor(int v)。//取頂點(diǎn)v的第一個(gè)鄰接頂點(diǎn) int getNextNeighbor(int v,int w)。//取v的鄰接頂點(diǎn)w的下一鄰接頂點(diǎn) bool insertVertex(char vertex)。//插入頂點(diǎn)vertex bool insertEdge(int v1,int v2,int weight)。//插入邊(v1,v2),權(quán)為weight bool removeVertex(int v)。//刪去頂點(diǎn)v和所有與它相關(guān)聯(lián)的邊 bool removeEdge(int v1,int v2)。//在圖中刪去邊(v1,v2) int getVertexPos(char vertex)//給出頂點(diǎn)vertex的位置,如果該頂點(diǎn)不在圖內(nèi)則返回1 { for(int i=0。inumVertices。i++) if(VerticesList[i]==vertex) return i。 return 1。 } int mini()。//求圖中所有邊的最小權(quán)值 bool input()。//輸入函數(shù) bool output()。//輸出函數(shù) void kruskal()。//kruskal算法 void prim()。//prim算法protected: int maxVertices。//圖中最大頂點(diǎn)數(shù) int numEdges。//圖中當(dāng)前邊數(shù) int numVertices。//圖中當(dāng)前頂點(diǎn)數(shù) private: char *VerticesList。//頂點(diǎn)表 int * *Edge。//鄰接矩陣 int visit[50]。//便利時(shí)的輔助工具 primnode closeedge[50]。//為實(shí)現(xiàn)prim 函數(shù)的輔助結(jié)點(diǎn)}。LJH_Graphmtx::LJH_Graphmtx(int sz)//構(gòu)造函數(shù){ maxVertices=sz。 numVertices=0。 numEdges=0。 int i,j。 VerticesList=new char[maxVertices]。//創(chuàng)建頂點(diǎn)表數(shù)組 Edge=(int * *)new int *[maxVertices]。//創(chuàng)建鄰接矩陣數(shù)組 for(i=0。imaxVertices。i++) Edge[i]=new int[maxVertices]。for(i=0。imaxVertices。i++)//鄰接矩陣初始化 for(j=0。jmaxVertices。j++) Edge[i][j]=(i==j)? 0 : maxWeight。}int LJH_Graphmtx::getFirstNeighbor(int v) { if(v!=1) { for(int i=0。inumVertices。i++) if(Edge[v][i]0amp。amp。Edge[v][i]maxWeight)return i。 } return 1。}int LJH_Graphmtx::getNextNeighbor(int v,int w)//給出頂點(diǎn)v的某鄰接頂點(diǎn)w的下一個(gè)鄰接頂點(diǎn)的位置,如果找不到,則函數(shù)返回1{ if(v!=1amp。amp。w!=1) {for(int i=w+1。inumVertices。i++) if(Edge[v][i]0amp。amp。Edge[v][i]maxWeight) return i。 } return 1。}bool LJH_Graphmtx::insertVertex(char vertex)//插入頂點(diǎn)vertex{ if(numVertices==maxVertices) return false。//頂點(diǎn)表滿(mǎn),不插入 VerticesList[numVertices++]=vertex。 return true。}bool LJH_Graphmtx::inser
點(diǎn)擊復(fù)制文檔內(nèi)容
醫(yī)療健康相關(guān)推薦
文庫(kù)吧 www.dybbs8.com
公安備案圖鄂ICP備17016276號(hào)-1