91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡介

最新版本 實現了代碼的優化 運行效率的提升 還新增了用戶界面 代碼內附注釋 可壓縮任何類型的文件 100%解壓

資源截圖

代碼片段和文件信息

#include
#include
#include
#include
#include
using?namespace?std;

struct?element
{
????int?weight;
????int?lchildrchildparent;
};
void?huffman_tree(element*?hufftreeint*?wint?n);//構造葉子節點長為n的哈夫曼樹
void?select(element*?hufftreeint?&aint?&bint?n);//找出權值最小的兩個節點
void?huffman_code(element*?hufftreeint?nstring*?code);//對哈夫曼樹進行編碼
void?fun(char*?strint?lenint?&n);//對文件的二進制串的數量進行統計?返回含有各個字符頻率的數組
string?elc(int?n);//根據index生成等長二進制編碼
void?compress();//壓縮函數
void?decompress();//解壓函數
int?conversion(string?code);//二進制碼轉十進制
string?i_to_s(int?l);
int?s_to_i(string?str);
int?getprefix(char?*strint?lstring?&typeint?&len);//返回去除了前綴的新下標
string?getstr(char*?strint?beginint?l);
int?dictionaries[256];//dictionaries對應的是hufftree的下標?知hufftree下標可知哈夫曼編碼code[dictionaries[index]]
int?freq[256];
string?equal_length_code[256];//等長的二進制編碼

int?main()
{
????string?choose;

while(true)
{
cout<<“輸入1壓縮文件?輸入2解壓文件?輸入其它退出“< cin>>choose;
if(choose==“1“)
compress();
else?if(choose==“2“)
decompress();
else
break;
system(“pause“);
}
????return?0;
}

void?select(element*?hufftreeint?&aint?&bint?n)
{
????int?t1t2;
????for(int?i=0;i<2*n-1;i++)
????{
????????if(hufftree[i].parent==-1)
????????{
????????????t1=i;
????????????a=i;
????????????break;
????????}
????}
????for(int?i=0;i<2*n-1;i++)
????{
????????if(hufftree[i].parent==-1&&i!=a)
????????{
????????????t2=i;
????????????b=i;
????????????break;
????????}
????}
????for(int?i=0;i<2*n-1;i++)
????{
????????if(hufftree[i].parent==-1&&i!=a&&(i????????????if(hufftree[i].weight????????????????a=i;
????}
????if(a==b)
????????b=t1;
????for(int?i=0;i<2*n-1;i++)
????{
????????if(hufftree[i].parent==-1&&i!=a&&i!=b&&(i????????????if(hufftree[i].weight????????????????b=i;
????}
}

void?huffman_tree(element*?hufftreeint*?wint?n)
{
????for(int?i=0;i<2*n-1;i++)
????{
????????hufftree[i].parent=-1;
????????hufftree[i].lchild=-1;
????????hufftree[i].rchild=-1;
????}
????for(int?i=0;i????????hufftree[i].weight=w[i];
????for(int?i=n;i<2*n-1;i++)
????{
????????int?ab;
????????select(hufftreeabn);
????????hufftree[a].parent=i;
????????hufftree[b].parent=i;
????????hufftree[i].lchild=a;//左最小
????????hufftree[i].rchild=b;
????????hufftree[i].weight=hufftree[a].weight+hufftree[b].weight;
????}
}

void?huffman_code(element*?hufftreeint?nstring*?code)
{
????for(int?i=0;i????{
????????int?p=i;
????????while(p!=2*n-2)
????????{
????????????if(hufftree[hufftree[p].parent].lchild==p)
????????????????code[i]=‘0‘+code[i];
????????????else
????????????????code[i]=‘1‘+code[i];
????????????p=hufftree[p].parent;
????????}
????}
}

void?fun(char*?strint?lenint?&n)
{
????n=0;

????for(int?i=0;i????{
?

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2018-12-13?19:40??新建文件夾\
?????目錄???????????0??2018-12-13?19:39??新建文件夾\lmycompress\
?????文件???????13217??2018-12-10?23:57??新建文件夾\lmycompress\compress_decompress.h
?????文件?????????401??2018-12-11?00:06??新建文件夾\lmycompress\lmycompress.pro
?????文件???????23856??2018-12-11?11:20??新建文件夾\lmycompress\lmycompress.pro.user
?????文件?????????175??2018-12-10?23:44??新建文件夾\lmycompress\main.cpp
?????文件?????????831??2018-12-11?00:21??新建文件夾\lmycompress\widget.cpp
?????文件?????????426??2018-12-10?23:57??新建文件夾\lmycompress\widget.h
?????文件????????1824??2018-12-10?23:59??新建文件夾\lmycompress\widget.ui
?????文件???????14267??2018-12-11?20:42??新建文件夾\壓縮.cpp
?????目錄???????????0??2018-12-13?19:39??新建文件夾\成品?可執行文件\
?????文件?????3643904??2018-04-12?07:34??新建文件夾\成品?可執行文件\D3Dcompiler_47.dll
?????文件?????5364224??2018-12-11?22:38??新建文件夾\成品?可執行文件\Qt5Core.dll
?????文件?????5650432??2016-05-26?01:16??新建文件夾\成品?可執行文件\Qt5Gui.dll
?????文件??????357888??2016-05-26?12:41??新建文件夾\成品?可執行文件\Qt5Svg.dll
?????文件?????6522368??2016-05-26?01:22??新建文件夾\成品?可執行文件\Qt5Widgets.dll
?????目錄???????????0??2018-12-13?19:38??新建文件夾\成品?可執行文件\iconengines\
?????文件???????43520??2016-05-26?12:41??新建文件夾\成品?可執行文件\iconengines\qsvgicon.dll
?????目錄???????????0??2018-12-13?19:38??新建文件夾\成品?可執行文件\imageformats\
?????文件???????58880??2016-05-26?15:42??新建文件夾\成品?可執行文件\imageformats\qdds.dll
?????文件???????33280??2016-05-26?01:25??新建文件夾\成品?可執行文件\imageformats\qgif.dll
?????文件???????46592??2016-05-26?15:42??新建文件夾\成品?可執行文件\imageformats\qicns.dll
?????文件???????35328??2016-05-26?01:25??新建文件夾\成品?可執行文件\imageformats\qico.dll
?????文件??????251904??2016-05-26?01:24??新建文件夾\成品?可執行文件\imageformats\qjpeg.dll
?????文件???????28672??2016-05-26?12:41??新建文件夾\成品?可執行文件\imageformats\qsvg.dll
?????文件???????27648??2016-05-26?15:42??新建文件夾\成品?可執行文件\imageformats\qtga.dll
?????文件??????496640??2016-05-26?15:42??新建文件夾\成品?可執行文件\imageformats\qtiff.dll
?????文件???????27648??2016-05-26?15:42??新建文件夾\成品?可執行文件\imageformats\qwbmp.dll
?????文件??????366080??2016-05-26?15:43??新建文件夾\成品?可執行文件\imageformats\qwebp.dll
?????文件???????20992??2016-05-26?01:09??新建文件夾\成品?可執行文件\libEGL.dll
?????文件?????2296320??2016-05-26?01:09??新建文件夾\成品?可執行文件\libGLESV2.dll
............此處省略25個文件信息

評論

共有 條評論