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

正文內(nèi)容

數(shù)據(jù)結(jié)構(gòu)實(shí)驗(yàn)六報(bào)告(已修改)

2025-11-08 18:01 本頁(yè)面
 

【正文】 第一篇:數(shù)據(jù)結(jié)構(gòu)實(shí)驗(yàn)六報(bào)告實(shí)驗(yàn)六報(bào)告課程名稱: 數(shù)據(jù)結(jié)構(gòu) 實(shí)驗(yàn)名稱:二叉樹的應(yīng)用實(shí)驗(yàn)日期2011/11/23一、實(shí)驗(yàn)?zāi)康模赫莆蘸辗蚵鏄涞慕⒓昂辗蚵幋a的生成。二、實(shí)驗(yàn)內(nèi)容與要求:根據(jù)給定的n個(gè)權(quán)值生成赫夫曼二叉樹,輸出赫夫曼編碼。三、數(shù)據(jù)結(jié)構(gòu)設(shè)計(jì)順序表的存儲(chǔ)結(jié)構(gòu),建立了二叉樹的關(guān)系Struct HTNode{int weight。unsigned int parent,lchild,rchild。}。四、算法設(shè)計(jì)從數(shù)據(jù)中選擇較小的兩個(gè)數(shù)據(jù)元素void Select(HTNode *HT, const int n, int amp。a, int amp。b){ //選擇較小的兩個(gè)元素} int x,y。x=y=0x7fff。for(int j=0。jif(HT[j].parent==0)if(HT[j].weight建立赫夫曼樹void CreatHuff(HTNode *HT,int *p,const int n){} int m=2*n1。int i,a,b。for(i=0。iSelect(HT ,i,a,b)。HT[a].parent=HT[b].parent=i。HT[i].weight=HT[a].weight+HT[b].weight。HT[i].lchild=a。HT[i].rchild=b。}生成赫夫曼編碼void HuffCoding(HTNode *HT, Huffcode amp。HC, const int n){//}HC=newchar*[n+1]。char *code=new char[n]。code[n1]=39。39。int i,j,p,k。for(i=0。i} delete[] code。j=n1。k=i。while(HT[k].parent){p=HT[k].parent。if(HT[p].lchild==k)code[j]=39。039。else code[j]=39。139。k=p。} HC[i]=(char*)malloc((nj)*sizeof(char))。HC[i]=new char[nj]。strcpy(HC[i],amp。code[j])。五、測(cè)試結(jié)果測(cè)試數(shù)據(jù)一:測(cè)試數(shù)據(jù)二:六、心得體會(huì)這次實(shí)驗(yàn)是在前面的實(shí)驗(yàn)基礎(chǔ)之上,加上只用了順序表的存儲(chǔ)結(jié)構(gòu),所以比較簡(jiǎn)單。盡管實(shí)驗(yàn)內(nèi)容少,但還是學(xué)到一些知識(shí)。首先學(xué)會(huì)了赫夫曼編碼的簡(jiǎn)單實(shí)現(xiàn),認(rèn)識(shí)到其應(yīng)用的實(shí)際價(jià)值。然后,學(xué)會(huì)了用指針數(shù)組,前面幾次試驗(yàn)有過嘗試,但沒寫成。這次實(shí)驗(yàn)最初也是用C++寫的,但錯(cuò)誤“無(wú)法解析的外部符號(hào)“public: void __thiscall HuffmanTree::HuffCoding(struct HTNode *,char * * amp。,int)”(?HuffCoding@HuffmanTree@@QAEXPAUHTNode@@AAPAPADH@Z),該符號(hào)在函數(shù)_main 中被引用”改不過來,所以迫于無(wú)奈,只得稍微改成像C的代碼。第二篇:數(shù)據(jù)結(jié)構(gòu)實(shí)驗(yàn)五報(bào)告實(shí)驗(yàn)五報(bào)告課程名稱: 數(shù)據(jù)結(jié)構(gòu) 實(shí)驗(yàn)名稱:二叉樹的創(chuàng)建與遍歷實(shí)驗(yàn)日期2011/11/16一、實(shí)驗(yàn)?zāi)康模和ㄟ^上機(jī)實(shí)驗(yàn)進(jìn)一步掌握棧、隊(duì)列、二叉樹的存儲(chǔ)結(jié)構(gòu)及基本操作的實(shí)現(xiàn)方法。二、實(shí)驗(yàn)內(nèi)容與要求:基于二叉鏈表存儲(chǔ)結(jié)構(gòu)實(shí)現(xiàn)二叉樹的基本運(yùn)算,要求:⑴能建立非空二叉樹;⑵實(shí)現(xiàn)二叉樹的先、中、后序遞歸遍歷算法;⑶實(shí)現(xiàn)二叉樹的非遞歸的先(或中、或后)序遍歷算法及層序遍歷算法;⑷記錄運(yùn)行結(jié)果并對(duì)遞歸算法和非遞歸算法的效率加以分析。三、算法設(shè)計(jì) 結(jié)構(gòu)體的定義:typedef struct BiTNote{struct Node{}。類的定義: class CStack{//棧 private:}。class LinkQueue{ //隊(duì)列 public: BiTree base。BiTree top。int stacksize。//當(dāng)前空間分配量 static const int STACK_INIT_SIZE=100。static const int STACKINCREMENT=10。CStack()。void Push(BiTree T)。//入棧 void Pop(BiTree amp。T)。//出棧 bool StackEmpty()。//判斷是否是空棧 friend class CBiTree。Node(BiTree amp。d):num(d),next(NULL){} BiTree num。Node *next。char data。struct BiTNote *lchild,*rchild。}BiTNote,*BiTree。public:}。LinkQueue()。bool QueueEmpty()。void EnQueue(BiTree amp。T)。void DeQueue(BiTree amp。T)。friend class CBiTree。int length。//隊(duì)列元素的個(gè)數(shù) Node *front。//隊(duì)列的頭指針 Node *rear。//隊(duì)列的尾指針 private: class CBiTree{ public:}。CStack::CStack():stacksize(STACK_INIT_SIZE){ //構(gòu)造函數(shù),初始化} void CStack::Push(BiTree T){...} //入棧 void CStack::Pop(BiTree amp。T){...} //出棧 bool CStack::StackEmpty(){} int i=0。//全局變量int CBiTree::CreatBiTree(BiTree amp。T){}//構(gòu)造二叉樹 //LinkQueue類函數(shù)的實(shí)現(xiàn) LinkQueue::LinkQueue(){} bool LinkQueue::QueueEmpty(){} void LinkQueue::EnQueue(BiTree amp。T){} void LinkQueue::DeQueue(BiTree amp。T){} int CBiTree::PreOrderTraverse1(BiTree T, int(*Visit)(char)){...} //前序遍歷(遞歸)int CBiTree::InOrderTraverse(BiTree T, int(*Visit)(char)){...} //中序遍歷(遞歸)int CBiTree::PostOrderTraverse(BiTree T, int(*Visit)(char)){...}//后序遍歷(遞歸)int CBiTree::PreOrderTraverse2(BiTree T, int(*Visit)(char)){ //前序遍歷(非遞歸)BiTree p=T。while
點(diǎn)擊復(fù)制文檔內(nèi)容
外語(yǔ)相關(guān)推薦
文庫(kù)吧 www.dybbs8.com
公安備案圖鄂ICP備17016276號(hào)-1