欢迎来到天天文库
浏览记录
ID:1344147
大小:185.88 KB
页数:19页
时间:2017-11-10
《数据结构实验报告_图的基本运算及飞机换乘次数最少问题》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、实验报告实验名称:二叉树的基本操作及哈夫曼编码译码系统的实现一、问题描述1.实验目的和要求a.创建一棵二叉树,实现先序、中序和后序遍历一棵二叉树,计算二叉树结点个数等操作。b.哈夫曼编码/译码系统。2.实验任务:能成功演示二叉树的有关运算,运算完毕后能成功释放二叉树所有结点占用的系统内存3.实验内容:a.①创建一棵二叉树;②先序、中序和后序遍历这棵二叉树;③计算二叉树结点个数b.哈夫曼编码译码系统二程序设计三.程序代码主函数:#include"CreateHfmTree.h"#include#includ
2、eusingnamespacestd;voidmain(){cout<<"<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"<3、endl;cout<<"'T'------Tracethetree:PreOrderandInOrdertheBTree."<4、hecodestoecodeandprinttheresultofencoding.(endwith'#')"<5、t,result.txtonthescreen."<hfm;HfmNode*ht;HfmCode*hc;ch6、ars[1000];repeat1:cout<>choice;cout<7、8、choice=='B'){cout<<"Pleaseinputthenumberofelementarycode:";cin>>n;cout<<"---------------------------------------------------------------"<9、emory..."<>data[i];cout<<"PleaseinputalltheFrenquencies:"<10、i>w[i];hfm=CreateHfmTree(w,data,4);gotorepeat1;}if(choice=='t'11、12、choice=='T'){cout<<"hfm";hfm.PreOrder(Visit);cout<<"hfm";hfm.InOrder(Visit);g
3、endl;cout<<"'T'------Tracethetree:PreOrderandInOrdertheBTree."<4、hecodestoecodeandprinttheresultofencoding.(endwith'#')"<5、t,result.txtonthescreen."<hfm;HfmNode*ht;HfmCode*hc;ch6、ars[1000];repeat1:cout<>choice;cout<7、8、choice=='B'){cout<<"Pleaseinputthenumberofelementarycode:";cin>>n;cout<<"---------------------------------------------------------------"<9、emory..."<>data[i];cout<<"PleaseinputalltheFrenquencies:"<10、i>w[i];hfm=CreateHfmTree(w,data,4);gotorepeat1;}if(choice=='t'11、12、choice=='T'){cout<<"hfm";hfm.PreOrder(Visit);cout<<"hfm";hfm.InOrder(Visit);g
4、hecodestoecodeandprinttheresultofencoding.(endwith'#')"<5、t,result.txtonthescreen."<hfm;HfmNode*ht;HfmCode*hc;ch6、ars[1000];repeat1:cout<>choice;cout<7、8、choice=='B'){cout<<"Pleaseinputthenumberofelementarycode:";cin>>n;cout<<"---------------------------------------------------------------"<9、emory..."<>data[i];cout<<"PleaseinputalltheFrenquencies:"<10、i>w[i];hfm=CreateHfmTree(w,data,4);gotorepeat1;}if(choice=='t'11、12、choice=='T'){cout<<"hfm";hfm.PreOrder(Visit);cout<<"hfm";hfm.InOrder(Visit);g
5、t,result.txtonthescreen."<hfm;HfmNode*ht;HfmCode*hc;ch
6、ars[1000];repeat1:cout<>choice;cout<7、8、choice=='B'){cout<<"Pleaseinputthenumberofelementarycode:";cin>>n;cout<<"---------------------------------------------------------------"<9、emory..."<>data[i];cout<<"PleaseinputalltheFrenquencies:"<10、i>w[i];hfm=CreateHfmTree(w,data,4);gotorepeat1;}if(choice=='t'11、12、choice=='T'){cout<<"hfm";hfm.PreOrder(Visit);cout<<"hfm";hfm.InOrder(Visit);g
7、
8、choice=='B'){cout<<"Pleaseinputthenumberofelementarycode:";cin>>n;cout<<"---------------------------------------------------------------"<9、emory..."<>data[i];cout<<"PleaseinputalltheFrenquencies:"<10、i>w[i];hfm=CreateHfmTree(w,data,4);gotorepeat1;}if(choice=='t'11、12、choice=='T'){cout<<"hfm";hfm.PreOrder(Visit);cout<<"hfm";hfm.InOrder(Visit);g
9、emory..."<>data[i];cout<<"PleaseinputalltheFrenquencies:"<10、i>w[i];hfm=CreateHfmTree(w,data,4);gotorepeat1;}if(choice=='t'11、12、choice=='T'){cout<<"hfm";hfm.PreOrder(Visit);cout<<"hfm";hfm.InOrder(Visit);g
10、i>w[i];hfm=CreateHfmTree(w,data,4);gotorepeat1;}if(choice=='t'
11、
12、choice=='T'){cout<<"hfm";hfm.PreOrder(Visit);cout<<"hfm";hfm.InOrder(Visit);g
此文档下载收益归作者所有