#include#include #include using namespace std; struct HTNode { int m_parent; int m_lchild; int m_rchild; int m_weight; }; struct HTree { HTNode * m_tree; int m_num; }; void InitHTree(HTree &HT, int num) { int total = 2 * num - 1; HT.m_tree = new HTNode[total]; if(!HT.m_tree) { cout<<"init fail"< >HT.m_tree[i].m_weight; HT.m_num++; } for(; i >num; InitHTree(mytree, num); showHTree(mytree); int pos = mytree.m_num; int min1, min2; FindTwoMin(mytree,pos,min1,min2); cout<<"min1="< >num; InitHTree(mytree, num); creatHTree(mytree, num); char ** code; HfCoding(mytree, code); showHfCoding(code, num); } int main() { //test(); homework(); system("pause"); return 0; }
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)