<?xml version="1.0"?>
<rss version="2.0">
   <channel>
      <title>Nhóm 7 - Câu 2 - Xử lý chuỗi dữ liệu (Nén tập) by Võ Minh Lợi</title>
      <link>https://padlet.com/minhloi1131130/uhkpff4qy751uzwf</link>
      <description>Đề tài của nhóm 7 là nén tệp tin.</description>
      <language>en-us</language>
      <pubDate>2022-01-08 14:54:57 UTC</pubDate>
      <lastBuildDate>2024-03-18 09:42:25 UTC</lastBuildDate>
      <webMaster>hello@padlet.com</webMaster>
      <image>
         <url></url>
      </image>
      <item>
         <title>Thành viên:</title>
         <author>minhloi1131130</author>
         <link>https://padlet.com/minhloi1131130/uhkpff4qy751uzwf/wish/1981714978</link>
         <description><![CDATA[<div>1. Nguyễn Bá Khoa<br>2. Trần Hữu Thắng<br>3. Võ Minh Lợi<br>4. Nguyễn Minh Đức</div>]]></description>
         <enclosure url="" />
         <pubDate>2022-01-08 14:58:12 UTC</pubDate>
         <guid>https://padlet.com/minhloi1131130/uhkpff4qy751uzwf/wish/1981714978</guid>
      </item>
      <item>
         <title>Mô tả thuật toán</title>
         <author>minhloi1131130</author>
         <link>https://padlet.com/minhloi1131130/uhkpff4qy751uzwf/wish/1981720297</link>
         <description><![CDATA[<div><strong>Thuật toán Huffman coding</strong> gồm 3 bước:</div><ul><li><strong>Bước 1</strong>: Đếm tần suất xuất hiện của các phần tử trong chuỗi đầu vào.</li><li><strong>Bước 2</strong>: Xây dựng cây Huffman (cây nhị phân mã hóa).<ul><li>Quá trình xây dựng cây Huffman gồm các bước sau:</li><li><em>2.1</em>. Tạo danh sách chứa các nút lá bao gồm phần tử đầu vào và trọng số nút là tần suất xuất hiện của nó.</li><li><em>2.2</em>. Từ danh sách này, lấy ra 2 phần tử có tần suất xuất hiện ít nhất. Sau đó gắn 2 nút vừa lấy ra vào một nút gốc mới với trọng số là tổng của 2 trọng số ở nút vừa lấy ra để tạo thành một cây.</li><li><em>2.3</em>. Đẩy cây mới vào lại danh sách.</li><li><em>2.4</em>. Lặp lại bước 2 và 3 cho đến khi danh sách chỉ còn 1 nút gốc duy nhất của cây.</li><li><em>2.5</em>. Nút còn lại chính là nút gốc của cây Huffman.</li></ul></li><li><strong>Bước 3</strong>: Từ cây Huffman, ta có được các giá trị mã hóa. Lúc này, ta có thể xây dựng chuỗi mã hóa từ các giá trị này.</li></ul>]]></description>
         <enclosure url="" />
         <pubDate>2022-01-08 15:06:45 UTC</pubDate>
         <guid>https://padlet.com/minhloi1131130/uhkpff4qy751uzwf/wish/1981720297</guid>
      </item>
      <item>
         <title>Cài đặt thuật toán</title>
         <author>minhloi1131130</author>
         <link>https://padlet.com/minhloi1131130/uhkpff4qy751uzwf/wish/1981721647</link>
         <description><![CDATA[<div>#include&lt;stdio.h&gt;<br>#include&lt;string.h&gt;<br>struct Huffdata{<br>&nbsp;char ma[8],kt[256];<br>&nbsp;int ts;<br>};<br>struct HNode{<br>&nbsp;Huffdata Data;<br>&nbsp;HNode *L,*R;<br>};<br>void taoTBTS(char s[],Huffdata TBTS[],int &amp;n)<br>{<br>&nbsp;int i,j,kt;<br>&nbsp;for (i=0;i&lt;strlen(s);i++)<br>&nbsp;{<br>&nbsp;kt=0;&nbsp;<br>&nbsp;for (j=1;j&lt;=n;j++)<br>&nbsp;if (TBTS[j].kt[0]==s[i])<br>&nbsp;{<br>&nbsp;TBTS[j].ts++;<br>&nbsp;kt=1;<br>&nbsp;}<br>&nbsp;if (kt==0)<br>&nbsp;{<br>&nbsp;n++;<br>&nbsp;TBTS[n].kt[0]=s[i];<br>&nbsp;TBTS[n].ts++;<br>&nbsp;}<br>&nbsp;}<br>}<br>void Sort(Huffdata a[], int n)<br>{<br>&nbsp;int i,j;<br>&nbsp;Huffdata tmp;<br>&nbsp;for (i=1;i&lt;n;i++)<br>&nbsp;for (j=i+1;j&lt;=n;j++)<br>&nbsp;if ((a[i].ts &gt; a[j].ts) || (a[i].ts==a[j].ts) &amp;&amp; (strcmp(a[i].kt,a[j].kt)&gt;0))<br>&nbsp;{<br>&nbsp;tmp=a[i];<br>&nbsp;a[i]=a[j];<br>&nbsp;a[j]=tmp;&nbsp;<br>&nbsp;}<br>}<br>void Insert(Huffdata a[],Huffdata pt,int &amp;n)<br>{<br>&nbsp;int vt=0,i;<br>&nbsp;while (pt.ts&gt;a[vt].ts &amp;&amp; vt&lt;=n)<br>&nbsp;vt++;<br>&nbsp;for (i=1;i&lt;vt;i++)<br>&nbsp;a[i]=a[i+1];<br>&nbsp;a[vt-1]=pt;<br>&nbsp;for (i=1;i&lt;n;i++)<br>&nbsp;a[i]=a[i+1];<br>&nbsp;n--;&nbsp;<br>}<br>HNode *taoHTree(Huffdata TBTS[],HNode *HTBTS[],int &amp;n)<br>{<br>&nbsp;int i=0,j=0,n1=0;<br>&nbsp;HNode *tmp,*pL,*pR;<br>&nbsp;while (TBTS[i].ts==0)<br>&nbsp;i++;<br>&nbsp;while (n&gt;=2)<br>&nbsp;{<br>&nbsp;tmp=new HNode;<br>&nbsp;pL= new HNode;<br>&nbsp;pR= new HNode;<br>&nbsp;pL-&gt;Data=TBTS[1];<br>&nbsp;pR-&gt;Data=TBTS[2];<br>&nbsp;pL-&gt;L=NULL;<br>&nbsp;pR-&gt;L=NULL;<br>&nbsp;pL-&gt;R=NULL;<br>&nbsp;pR-&gt;R=NULL;<br>&nbsp;for (i=1;i&lt;=n1;i++)<br>&nbsp;{<br>&nbsp;if (strcmp(pL-&gt;Data.kt,HTBTS[i]-&gt;Data.kt)==0)<br>&nbsp;pL=HTBTS[i];<br>&nbsp;if (strcmp(pR-&gt;Data.kt,HTBTS[i]-&gt;Data.kt)==0)<br>&nbsp;pR=HTBTS[i];<br>&nbsp;}<br>&nbsp;tmp-&gt;L=pL;<br>&nbsp;tmp-&gt;R=pR;<br>&nbsp;strcpy(tmp-&gt;Data.kt,"");<br>&nbsp;strcat(tmp-&gt;Data.kt,pL-&gt;Data.kt);<br>&nbsp;strcat(tmp-&gt;Data.kt,pR-&gt;Data.kt);<br>&nbsp;tmp-&gt;Data.ts=pL-&gt;Data.ts+pR-&gt;Data.ts;<br>&nbsp;n1++;<br>&nbsp;HTBTS[n1]=tmp;<br>&nbsp;Insert(TBTS,tmp-&gt;Data,n);<br>&nbsp;}<br>&nbsp;return HTBTS[n1];<br>}<br>void Duyet(HNode *Tr)<br>{<br>&nbsp;if (Tr!=NULL)<br>&nbsp;{<br>&nbsp;Duyet(Tr-&gt;R);<br>&nbsp;Duyet(Tr-&gt;L);<br>&nbsp;printf("%s : &nbsp; %d\n",Tr-&gt;Data.kt,Tr-&gt;Data.ts);<br>&nbsp;}<br>}<br>void taoTBMB(HNode *Tr,Huffdata TBMB[],int &amp;n,char ma[])<br>{<br>&nbsp;char tam[8];<br>&nbsp;if (Tr!=NULL)<br>&nbsp;{<br>&nbsp;if (Tr-&gt;R!=NULL)<br>&nbsp;{<br>&nbsp;strcat(ma,"1");<br>&nbsp;taoTBMB(Tr-&gt;R,TBMB,n,ma);<br>&nbsp;strcpy(tam,"");<br>&nbsp;strncat(tam,ma,strlen(ma)-1);<br>&nbsp;strcpy(ma,tam);<br>&nbsp;}<br>&nbsp;if (Tr-&gt;L!=NULL)<br>&nbsp;{<br>&nbsp;strcat(ma,"0");<br>&nbsp;taoTBMB(Tr-&gt;L,TBMB,n,ma);<br>&nbsp;strcpy(tam,"");<br>&nbsp;strncat(tam,ma,strlen(ma)-1);<br>&nbsp;strcpy(ma,tam);<br>&nbsp;}<br>&nbsp;if (Tr-&gt;L==NULL &amp;&amp; Tr-&gt;R==NULL)<br>&nbsp;{<br>&nbsp;n++;<br>&nbsp;strcpy(TBMB[n].kt,Tr-&gt;Data.kt);<br>&nbsp;strcpy(TBMB[n].ma,ma);<br>&nbsp;}<br>&nbsp;}<br>}<br>void nen(char s[],char snen[],Huffdata TBMB[],int n)<br>{<br>&nbsp;int i,j;<br>&nbsp;for (i=0;i&lt;strlen(s);i++)<br>&nbsp;{<br>&nbsp;for (j=1;j&lt;=n;j++)<br>&nbsp;if (s[i]==TBMB[j].kt[0])<br>&nbsp;strcat(snen,TBMB[j].ma);<br>&nbsp;}<br>}<br>void giainen(char snen[],HNode *Tr)<br>{<br>&nbsp;int i,kt=0;<br>&nbsp;HNode *tmp=Tr;<br>&nbsp;for (i=0;i&lt;=strlen(snen);i++)<br>&nbsp;{<br>&nbsp;if (snen[i]=='1')<br>&nbsp;tmp=tmp-&gt;R;<br>&nbsp;else<br>&nbsp;tmp=tmp-&gt;L;<br>&nbsp;if (tmp-&gt;L==NULL &amp;&amp; tmp-&gt;R==NULL)<br>&nbsp;{<br>&nbsp;printf("%s",tmp-&gt;Data.kt);<br>&nbsp;tmp=Tr;<br>&nbsp;}<br>&nbsp;}<br>}<br>main()<br>{<br>&nbsp;char string[100]="NHOM7nhom7NHOM7",s[1000];<br>&nbsp;fflush(stdin);<br>&nbsp;<br>&nbsp;printf("Xau goc:\n%s\n",string);<br>&nbsp;int n=0,nb=0,i,j;<br>&nbsp;char ma[8];<br>&nbsp;Huffdata TBTS[256],TBMB[256];<br>&nbsp;HNode *Tree=NULL,*TB[100];<br>&nbsp;taoTBTS(string,TBTS,n);<br>&nbsp;Sort(TBTS,n);<br>&nbsp;printf("\nBang tan so:\n");<br>&nbsp;for (i=1;i&lt;=n;i++)<br>&nbsp;printf("%s&nbsp; %d\n",TBTS[i].kt,TBTS[i].ts);<br>&nbsp;fflush(stdin);<br>&nbsp;Tree=taoHTree(TBTS,TB,n);<br>&nbsp;printf("\nDuyet cay Huffman \n");<br>&nbsp;Duyet(Tree);<br>&nbsp;strcpy(ma,"");<br>&nbsp;taoTBMB(Tree,TBMB,nb,ma);<br>&nbsp;printf("\nBang ma bit:\n");<br>&nbsp;for (i=1;i&lt;=nb;i++)<br>&nbsp;printf("%s&nbsp; %s\n",TBMB[i].kt,TBMB[i].ma);<br>&nbsp;strcpy(s,"");<br>&nbsp;nen(string,s,TBMB,nb);<br>&nbsp;printf("\nXau sau khi nen:\n");<br>&nbsp;printf("%s\n",s);<br>&nbsp;printf("\nXau sau khi giai nen:\n");<br>&nbsp;giainen(s,Tree);<br>}</div>]]></description>
         <enclosure url="" />
         <pubDate>2022-01-08 15:09:13 UTC</pubDate>
         <guid>https://padlet.com/minhloi1131130/uhkpff4qy751uzwf/wish/1981721647</guid>
      </item>
      <item>
         <title>Minh họa thuật toán</title>
         <author>minhloi1131130</author>
         <link>https://padlet.com/minhloi1131130/uhkpff4qy751uzwf/wish/1982154165</link>
         <description><![CDATA[]]></description>
         <enclosure url="https://padlet-uploads.storage.googleapis.com/1259228039/fa787c6b9e63a2b32caa946a658786e6/image.png" />
         <pubDate>2022-01-09 08:54:45 UTC</pubDate>
         <guid>https://padlet.com/minhloi1131130/uhkpff4qy751uzwf/wish/1982154165</guid>
      </item>
      <item>
         <title>LINK PADLET:</title>
         <author>minhloi1131130</author>
         <link>https://padlet.com/minhloi1131130/uhkpff4qy751uzwf/wish/1983067109</link>
         <description><![CDATA[<div>https://padlet.com/minhloi1131130/uhkpff4qy751uzwf</div>]]></description>
         <enclosure url="https://padlet.com/minhloi1131130/uhkpff4qy751uzwf" />
         <pubDate>2022-01-10 04:48:05 UTC</pubDate>
         <guid>https://padlet.com/minhloi1131130/uhkpff4qy751uzwf/wish/1983067109</guid>
      </item>
      <item>
         <title>Mô tả thuật toán</title>
         <author>minhloi1131130</author>
         <link>https://padlet.com/minhloi1131130/uhkpff4qy751uzwf/wish/1983068293</link>
         <description><![CDATA[<div><strong>Thuật toán Huffman coding</strong> gồm 3 bước:</div><ul><li><strong>Bước 1</strong>: Đếm tần suất xuất hiện của các phần tử trong chuỗi đầu vào.</li><li><strong>Bước 2</strong>: Xây dựng cây Huffman (cây nhị phân mã hóa).<ul><li>Quá trình xây dựng cây Huffman gồm các bước sau:</li><li><em>2.1</em>. Tạo danh sách chứa các nút lá bao gồm phần tử đầu vào và trọng số nút là tần suất xuất hiện của nó.</li><li><em>2.2</em>. Từ danh sách này, lấy ra 2 phần tử có tần suất xuất hiện ít nhất. Sau đó gắn 2 nút vừa lấy ra vào một nút gốc mới với trọng số là tổng của 2 trọng số ở nút vừa lấy ra để tạo thành một cây.</li><li><em>2.3</em>. Đẩy cây mới vào lại danh sách.</li><li><em>2.4</em>. Lặp lại bước 2 và 3 cho đến khi danh sách chỉ còn 1 nút gốc duy nhất của cây.</li><li><em>2.5</em>. Nút còn lại chính là nút gốc của cây Huffman.</li></ul></li><li><strong>Bước 3</strong>: Từ cây Huffman, ta có được các giá trị mã hóa. Lúc này, ta có thể xây dựng chuỗi mã hóa từ các giá trị này.</li></ul>]]></description>
         <enclosure url="" />
         <pubDate>2022-01-10 04:49:16 UTC</pubDate>
         <guid>https://padlet.com/minhloi1131130/uhkpff4qy751uzwf/wish/1983068293</guid>
      </item>
      <item>
         <title>Cài đặt thuật toán</title>
         <author>minhloi1131130</author>
         <link>https://padlet.com/minhloi1131130/uhkpff4qy751uzwf/wish/1983069143</link>
         <description><![CDATA[<div>#include&lt;stdio.h&gt;<br>#include&lt;string.h&gt;<br>struct Huffdata{<br>&nbsp;char ma[8],kt[256];<br>&nbsp;int ts;<br>};<br>struct HNode{<br>&nbsp;Huffdata Data;<br>&nbsp;HNode *L,*R;<br>};<br>void taoTBTS(char s[],Huffdata TBTS[],int &amp;n)<br>{<br>&nbsp;int i,j,kt;<br>&nbsp;for (i=0;i&lt;strlen(s);i++)<br>&nbsp;{<br>&nbsp;kt=0;&nbsp;<br>&nbsp;for (j=1;j&lt;=n;j++)<br>&nbsp;if (TBTS[j].kt[0]==s[i])<br>&nbsp;{<br>&nbsp;TBTS[j].ts++;<br>&nbsp;kt=1;<br>&nbsp;}<br>&nbsp;if (kt==0)<br>&nbsp;{<br>&nbsp;n++;<br>&nbsp;TBTS[n].kt[0]=s[i];<br>&nbsp;TBTS[n].ts++;<br>&nbsp;}<br>&nbsp;}<br>}<br>void Sort(Huffdata a[], int n)<br>{<br>&nbsp;int i,j;<br>&nbsp;Huffdata tmp;<br>&nbsp;for (i=1;i&lt;n;i++)<br>&nbsp;for (j=i+1;j&lt;=n;j++)<br>&nbsp;if ((a[i].ts &gt; a[j].ts) || (a[i].ts==a[j].ts) &amp;&amp; (strcmp(a[i].kt,a[j].kt)&gt;0))<br>&nbsp;{<br>&nbsp;tmp=a[i];<br>&nbsp;a[i]=a[j];<br>&nbsp;a[j]=tmp;&nbsp;<br>&nbsp;}<br>}<br>void Insert(Huffdata a[],Huffdata pt,int &amp;n)<br>{<br>&nbsp;int vt=0,i;<br>&nbsp;while (pt.ts&gt;a[vt].ts &amp;&amp; vt&lt;=n)<br>&nbsp;vt++;<br>&nbsp;for (i=1;i&lt;vt;i++)<br>&nbsp;a[i]=a[i+1];<br>&nbsp;a[vt-1]=pt;<br>&nbsp;for (i=1;i&lt;n;i++)<br>&nbsp;a[i]=a[i+1];<br>&nbsp;n--;&nbsp;<br>}<br>HNode *taoHTree(Huffdata TBTS[],HNode *HTBTS[],int &amp;n)<br>{<br>&nbsp;int i=0,j=0,n1=0;<br>&nbsp;HNode *tmp,*pL,*pR;<br>&nbsp;while (TBTS[i].ts==0)<br>&nbsp;i++;<br>&nbsp;while (n&gt;=2)<br>&nbsp;{<br>&nbsp;tmp=new HNode;<br>&nbsp;pL= new HNode;<br>&nbsp;pR= new HNode;<br>&nbsp;pL-&gt;Data=TBTS[1];<br>&nbsp;pR-&gt;Data=TBTS[2];<br>&nbsp;pL-&gt;L=NULL;<br>&nbsp;pR-&gt;L=NULL;<br>&nbsp;pL-&gt;R=NULL;<br>&nbsp;pR-&gt;R=NULL;<br>&nbsp;for (i=1;i&lt;=n1;i++)<br>&nbsp;{<br>&nbsp;if (strcmp(pL-&gt;Data.kt,HTBTS[i]-&gt;Data.kt)==0)<br>&nbsp;pL=HTBTS[i];<br>&nbsp;if (strcmp(pR-&gt;Data.kt,HTBTS[i]-&gt;Data.kt)==0)<br>&nbsp;pR=HTBTS[i];<br>&nbsp;}<br>&nbsp;tmp-&gt;L=pL;<br>&nbsp;tmp-&gt;R=pR;<br>&nbsp;strcpy(tmp-&gt;Data.kt,"");<br>&nbsp;strcat(tmp-&gt;Data.kt,pL-&gt;Data.kt);<br>&nbsp;strcat(tmp-&gt;Data.kt,pR-&gt;Data.kt);<br>&nbsp;tmp-&gt;Data.ts=pL-&gt;Data.ts+pR-&gt;Data.ts;<br>&nbsp;n1++;<br>&nbsp;HTBTS[n1]=tmp;<br>&nbsp;Insert(TBTS,tmp-&gt;Data,n);<br>&nbsp;}<br>&nbsp;return HTBTS[n1];<br>}<br>void Duyet(HNode *Tr)<br>{<br>&nbsp;if (Tr!=NULL)<br>&nbsp;{<br>&nbsp;Duyet(Tr-&gt;R);<br>&nbsp;Duyet(Tr-&gt;L);<br>&nbsp;printf("%s : &nbsp; %d\n",Tr-&gt;Data.kt,Tr-&gt;Data.ts);<br>&nbsp;}<br>}<br>void taoTBMB(HNode *Tr,Huffdata TBMB[],int &amp;n,char ma[])<br>{<br>&nbsp;char tam[8];<br>&nbsp;if (Tr!=NULL)<br>&nbsp;{<br>&nbsp;if (Tr-&gt;R!=NULL)<br>&nbsp;{<br>&nbsp;strcat(ma,"1");<br>&nbsp;taoTBMB(Tr-&gt;R,TBMB,n,ma);<br>&nbsp;strcpy(tam,"");<br>&nbsp;strncat(tam,ma,strlen(ma)-1);<br>&nbsp;strcpy(ma,tam);<br>&nbsp;}<br>&nbsp;if (Tr-&gt;L!=NULL)<br>&nbsp;{<br>&nbsp;strcat(ma,"0");<br>&nbsp;taoTBMB(Tr-&gt;L,TBMB,n,ma);<br>&nbsp;strcpy(tam,"");<br>&nbsp;strncat(tam,ma,strlen(ma)-1);<br>&nbsp;strcpy(ma,tam);<br>&nbsp;}<br>&nbsp;if (Tr-&gt;L==NULL &amp;&amp; Tr-&gt;R==NULL)<br>&nbsp;{<br>&nbsp;n++;<br>&nbsp;strcpy(TBMB[n].kt,Tr-&gt;Data.kt);<br>&nbsp;strcpy(TBMB[n].ma,ma);<br>&nbsp;}<br>&nbsp;}<br>}<br>void nen(char s[],char snen[],Huffdata TBMB[],int n)<br>{<br>&nbsp;int i,j;<br>&nbsp;for (i=0;i&lt;strlen(s);i++)<br>&nbsp;{<br>&nbsp;for (j=1;j&lt;=n;j++)<br>&nbsp;if (s[i]==TBMB[j].kt[0])<br>&nbsp;strcat(snen,TBMB[j].ma);<br>&nbsp;}<br>}<br>void giainen(char snen[],HNode *Tr)<br>{<br>&nbsp;int i,kt=0;<br>&nbsp;HNode *tmp=Tr;<br>&nbsp;for (i=0;i&lt;=strlen(snen);i++)<br>&nbsp;{<br>&nbsp;if (snen[i]=='1')<br>&nbsp;tmp=tmp-&gt;R;<br>&nbsp;else<br>&nbsp;tmp=tmp-&gt;L;<br>&nbsp;if (tmp-&gt;L==NULL &amp;&amp; tmp-&gt;R==NULL)<br>&nbsp;{<br>&nbsp;printf("%s",tmp-&gt;Data.kt);<br>&nbsp;tmp=Tr;<br>&nbsp;}<br>&nbsp;}<br>}<br>main()<br>{<br>&nbsp;char string[100]="NHOM7nhom7NHOM7",s[1000];<br>&nbsp;fflush(stdin);<br>&nbsp;<br>&nbsp;printf("Xau goc:\n%s\n",string);<br>&nbsp;int n=0,nb=0,i,j;<br>&nbsp;char ma[8];<br>&nbsp;Huffdata TBTS[256],TBMB[256];<br>&nbsp;HNode *Tree=NULL,*TB[100];<br>&nbsp;taoTBTS(string,TBTS,n);<br>&nbsp;Sort(TBTS,n);<br>&nbsp;printf("\nBang tan so:\n");<br>&nbsp;for (i=1;i&lt;=n;i++)<br>&nbsp;printf("%s&nbsp; %d\n",TBTS[i].kt,TBTS[i].ts);<br>&nbsp;fflush(stdin);<br>&nbsp;Tree=taoHTree(TBTS,TB,n);<br>&nbsp;printf("\nDuyet cay Huffman \n");<br>&nbsp;Duyet(Tree);<br>&nbsp;strcpy(ma,"");<br>&nbsp;taoTBMB(Tree,TBMB,nb,ma);<br>&nbsp;printf("\nBang ma bit:\n");<br>&nbsp;for (i=1;i&lt;=nb;i++)<br>&nbsp;printf("%s&nbsp; %s\n",TBMB[i].kt,TBMB[i].ma);<br>&nbsp;strcpy(s,"");<br>&nbsp;nen(string,s,TBMB,nb);<br>&nbsp;printf("\nXau sau khi nen:\n");<br>&nbsp;printf("%s\n",s);<br>&nbsp;printf("\nXau sau khi giai nen:\n");<br>&nbsp;giainen(s,Tree);<br>}</div>]]></description>
         <enclosure url="" />
         <pubDate>2022-01-10 04:50:07 UTC</pubDate>
         <guid>https://padlet.com/minhloi1131130/uhkpff4qy751uzwf/wish/1983069143</guid>
      </item>
      <item>
         <title>Minh họa thuật toán</title>
         <author>minhloi1131130</author>
         <link>https://padlet.com/minhloi1131130/uhkpff4qy751uzwf/wish/1983069832</link>
         <description><![CDATA[]]></description>
         <enclosure url="https://padlet-uploads.storage.googleapis.com/1259228039/47ad9f923c6b31ddedf18a76cbddab7d/image.png" />
         <pubDate>2022-01-10 04:50:48 UTC</pubDate>
         <guid>https://padlet.com/minhloi1131130/uhkpff4qy751uzwf/wish/1983069832</guid>
      </item>
      <item>
         <title>mô tả thuật toán</title>
         <author>tranthang9b2016</author>
         <link>https://padlet.com/minhloi1131130/uhkpff4qy751uzwf/wish/1983715361</link>
         <description><![CDATA[<div>&nbsp;B1: Duyệt file, lập bảng thống kê tuần suất xuất hiện của mỗi ký tự.&nbsp;<br>&nbsp;B2: Xây dựng cây Huffman dựa vào bảng thống kê.&nbsp;<br>&nbsp;B3: Sinh mã Huffman cho mỗi ký tự dựa vào cây Huffman.&nbsp;<br>&nbsp;B4: Duyệt file, thay toàn bộ ký tự bằng mã Huffman tương ứng.&nbsp;&nbsp;</div>]]></description>
         <enclosure url="" />
         <pubDate>2022-01-10 12:52:49 UTC</pubDate>
         <guid>https://padlet.com/minhloi1131130/uhkpff4qy751uzwf/wish/1983715361</guid>
      </item>
      <item>
         <title>cài đặt thuật toán</title>
         <author>tranthang9b2016</author>
         <link>https://padlet.com/minhloi1131130/uhkpff4qy751uzwf/wish/1983736077</link>
         <description><![CDATA[<div>#include&lt;stdio.h&gt;<br>#include&lt;string.h&gt;<br>struct Huffdata{<br>&nbsp;char ma[8],kt[256];<br>&nbsp;int ts;<br>};<br>struct HNode{<br>&nbsp;Huffdata Data;<br>&nbsp;HNode *L,*R;<br>};<br>void taoTBTS(char s[],Huffdata TBTS[],int &amp;n)<br>{<br>&nbsp;int i,j,kt;<br>&nbsp;for (i=0;i&lt;strlen(s);i++)<br>&nbsp;{<br>&nbsp;kt=0;&nbsp;<br>&nbsp;for (j=1;j&lt;=n;j++)<br>&nbsp;if (TBTS[j].kt[0]==s[i])<br>&nbsp;{<br>&nbsp;TBTS[j].ts++;<br>&nbsp;kt=1;<br>&nbsp;}<br>&nbsp;if (kt==0)<br>&nbsp;{<br>&nbsp;n++;<br>&nbsp;TBTS[n].kt[0]=s[i];<br>&nbsp;TBTS[n].ts++;<br>&nbsp;}<br>&nbsp;}<br>}<br>void Sort(Huffdata a[], int n)<br>{<br>&nbsp;int i,j;<br>&nbsp;Huffdata tmp;<br>&nbsp;for (i=1;i&lt;n;i++)<br>&nbsp;for (j=i+1;j&lt;=n;j++)<br>&nbsp;if ((a[i].ts &gt; a[j].ts) || (a[i].ts==a[j].ts) &amp;&amp; (strcmp(a[i].kt,a[j].kt)&gt;0))<br>&nbsp;{<br>&nbsp;tmp=a[i];<br>&nbsp;a[i]=a[j];<br>&nbsp;a[j]=tmp;&nbsp;<br>&nbsp;}<br>}<br>void Insert(Huffdata a[],Huffdata pt,int &amp;n)<br>{<br>&nbsp;int vt=0,i;<br>&nbsp;while (pt.ts&gt;a[vt].ts &amp;&amp; vt&lt;=n)<br>&nbsp;vt++;<br>&nbsp;for (i=1;i&lt;vt;i++)<br>&nbsp;a[i]=a[i+1];<br>&nbsp;a[vt-1]=pt;<br>&nbsp;for (i=1;i&lt;n;i++)<br>&nbsp;a[i]=a[i+1];<br>&nbsp;n--;&nbsp;<br>}<br>HNode *taoHTree(Huffdata TBTS[],HNode *HTBTS[],int &amp;n)<br>{<br>&nbsp;int i=0,j=0,n1=0;<br>&nbsp;HNode *tmp,*pL,*pR;<br>&nbsp;while (TBTS[i].ts==0)<br>&nbsp;i++;<br>&nbsp;while (n&gt;=2)<br>&nbsp;{<br>&nbsp;tmp=new HNode;<br>&nbsp;pL= new HNode;<br>&nbsp;pR= new HNode;<br>&nbsp;pL-&gt;Data=TBTS[1];<br>&nbsp;pR-&gt;Data=TBTS[2];<br>&nbsp;pL-&gt;L=NULL;<br>&nbsp;pR-&gt;L=NULL;<br>&nbsp;pL-&gt;R=NULL;<br>&nbsp;pR-&gt;R=NULL;<br>&nbsp;for (i=1;i&lt;=n1;i++)<br>&nbsp;{<br>&nbsp;if (strcmp(pL-&gt;Data.kt,HTBTS[i]-&gt;Data.kt)==0)<br>&nbsp;pL=HTBTS[i];<br>&nbsp;if (strcmp(pR-&gt;Data.kt,HTBTS[i]-&gt;Data.kt)==0)<br>&nbsp;pR=HTBTS[i];<br>&nbsp;}<br>&nbsp;tmp-&gt;L=pL;<br>&nbsp;tmp-&gt;R=pR;<br>&nbsp;strcpy(tmp-&gt;Data.kt,"");<br>&nbsp;strcat(tmp-&gt;Data.kt,pL-&gt;Data.kt);<br>&nbsp;strcat(tmp-&gt;Data.kt,pR-&gt;Data.kt);<br>&nbsp;tmp-&gt;Data.ts=pL-&gt;Data.ts+pR-&gt;Data.ts;<br>&nbsp;n1++;<br>&nbsp;HTBTS[n1]=tmp;<br>&nbsp;Insert(TBTS,tmp-&gt;Data,n);<br>&nbsp;}<br>&nbsp;return HTBTS[n1];<br>}<br>void Duyet(HNode *Tr)<br>{<br>&nbsp;if (Tr!=NULL)<br>&nbsp;{<br>&nbsp;Duyet(Tr-&gt;R);<br>&nbsp;Duyet(Tr-&gt;L);<br>&nbsp;printf("%s : %d&nbsp; &nbsp; \t",Tr-&gt;Data.kt,Tr-&gt;Data.ts);<br>&nbsp;}<br>}<br>void taoTBMB(HNode *Tr,Huffdata TBMB[],int &amp;n,char ma[])<br>{<br>&nbsp;char tam[8];<br>&nbsp;if (Tr!=NULL)<br>&nbsp;{<br>&nbsp;if (Tr-&gt;R!=NULL)<br>&nbsp;{<br>&nbsp;strcat(ma,"1");<br>&nbsp;taoTBMB(Tr-&gt;R,TBMB,n,ma);<br>&nbsp;strcpy(tam,"");<br>&nbsp;strncat(tam,ma,strlen(ma)-1);<br>&nbsp;strcpy(ma,tam);<br>&nbsp;}<br>&nbsp;if (Tr-&gt;L!=NULL)<br>&nbsp;{<br>&nbsp;strcat(ma,"0");<br>&nbsp;taoTBMB(Tr-&gt;L,TBMB,n,ma);<br>&nbsp;strcpy(tam,"");<br>&nbsp;strncat(tam,ma,strlen(ma)-1);<br>&nbsp;strcpy(ma,tam);<br>&nbsp;}<br>&nbsp;if (Tr-&gt;L==NULL &amp;&amp; Tr-&gt;R==NULL)<br>&nbsp;{<br>&nbsp;n++;<br>&nbsp;strcpy(TBMB[n].kt,Tr-&gt;Data.kt);<br>&nbsp;strcpy(TBMB[n].ma,ma);<br>&nbsp;}<br>&nbsp;}<br>}<br>void nen(char s[],char snen[],Huffdata TBMB[],int n)<br>{<br>&nbsp;int i,j;<br>&nbsp;for (i=0;i&lt;strlen(s);i++)<br>&nbsp;{<br>&nbsp;for (j=1;j&lt;=n;j++)<br>&nbsp;if (s[i]==TBMB[j].kt[0])<br>&nbsp;strcat(snen,TBMB[j].ma);<br>&nbsp;}<br>}<br>void giainen(char snen[],HNode *Tr)<br>{<br>&nbsp;int i,kt=0;<br>&nbsp;HNode *tmp=Tr;<br>&nbsp;for (i=0;i&lt;=strlen(snen);i++)<br>&nbsp;{<br>&nbsp;if (snen[i]=='1')<br>&nbsp;tmp=tmp-&gt;R;<br>&nbsp;else<br>&nbsp;tmp=tmp-&gt;L;<br>&nbsp;if (tmp-&gt;L==NULL &amp;&amp; tmp-&gt;R==NULL)<br>&nbsp;{<br>&nbsp;printf("%s",tmp-&gt;Data.kt);<br>&nbsp;tmp=Tr;<br>&nbsp;}<br>&nbsp;}<br>}<br>main()<br>{<br>&nbsp;char string[100]="baitapgiainen",s[1000];<br>&nbsp;fflush(stdin);<br>&nbsp;printf("Xau goc: %s",string);<br>&nbsp;int n=0,nb=0,i,j;<br>&nbsp;char ma[8];<br>&nbsp;Huffdata TBTS[256],TBMB[256];<br>&nbsp;HNode *Tree=NULL,*TB[100];<br>&nbsp;taoTBTS(string,TBTS,n);<br>&nbsp;Sort(TBTS,n);<br>&nbsp;printf("\nBang tan so:\n");<br>&nbsp;for (i=1;i&lt;=n;i++)<br>&nbsp;printf("%s = %d\t",TBTS[i].kt,TBTS[i].ts);<br>&nbsp;fflush(stdin);<br>&nbsp;Tree=taoHTree(TBTS,TB,n);<br>&nbsp;printf("\nDuyet cay Huffman \n");<br>&nbsp;Duyet(Tree);<br>&nbsp;strcpy(ma,"");<br>&nbsp;taoTBMB(Tree,TBMB,nb,ma);<br>&nbsp;printf("\nBang ma bit:\n");<br>&nbsp;for (i=1;i&lt;=nb;i++)<br>&nbsp;printf("%s = %s\t",TBMB[i].kt,TBMB[i].ma);<br>&nbsp;strcpy(s,"");<br>&nbsp;nen(string,s,TBMB,nb);<br>&nbsp;printf("\nXau sau khi nen:\n");<br>&nbsp;printf("%s\t",s);<br>&nbsp;printf("\nXau sau khi giai nen:\n");<br>&nbsp;giainen(s,Tree);<br>}</div>]]></description>
         <enclosure url="" />
         <pubDate>2022-01-10 13:05:36 UTC</pubDate>
         <guid>https://padlet.com/minhloi1131130/uhkpff4qy751uzwf/wish/1983736077</guid>
      </item>
      <item>
         <title></title>
         <author>tranthang9b2016</author>
         <link>https://padlet.com/minhloi1131130/uhkpff4qy751uzwf/wish/1983737943</link>
         <description><![CDATA[]]></description>
         <enclosure url="https://padlet-uploads.storage.googleapis.com/926942173/b95648de2bf5db390f6d1121973912a0/anhnen.png" />
         <pubDate>2022-01-10 13:06:31 UTC</pubDate>
         <guid>https://padlet.com/minhloi1131130/uhkpff4qy751uzwf/wish/1983737943</guid>
      </item>
      <item>
         <title>Mô tả thuật toán</title>
         <author>khoana23062002</author>
         <link>https://padlet.com/minhloi1131130/uhkpff4qy751uzwf/wish/1983894139</link>
         <description><![CDATA[<div>Bước 1: tạo hàm RLE, cho chạy từ 1 đến độ dài mảng -1,cho đếm cộng 1 và nếu phần tử trước khác phần tử sau thì thực hiện các việc giao mảng đếm giá trị trị rỗng&nbsp;<br>Bước 2: tạo đếm từ d và gán cho dem bằng giá trị của dữ liệu file tại vị trí phần tử trước,<br>Bước 3:&nbsp;tiếp theo nối chuổi dem với mảng của compressFile, cuối cùng cho d bằng 0 trở lại.</div>]]></description>
         <enclosure url="" />
         <pubDate>2022-01-10 14:15:09 UTC</pubDate>
         <guid>https://padlet.com/minhloi1131130/uhkpff4qy751uzwf/wish/1983894139</guid>
      </item>
      <item>
         <title>Cài đặt thuật toán </title>
         <author>khoana23062002</author>
         <link>https://padlet.com/minhloi1131130/uhkpff4qy751uzwf/wish/1983895220</link>
         <description><![CDATA[<div>#include&lt;stdio.h&gt;<br>#include&lt;string.h&gt;<br>void compressFile(<br>	char fileData[],<br>	char compressFileData[]	<br>)<br>{<br>	int d=0;<br>	char dem[100];<br>	for (int i = 0; i &lt;= strlen(fileData) - 1; i++)<br>	{<br>		d++;<br>		if (fileData[i] != fileData[i + 1] )<br>			{<br>				strcpy(dem,"");<br>				sprintf(dem,"%d",d);<br>				dem[strlen(dem)]=fileData[i];<br>				strcat(compressFileData,dem);<br>				d=0;<br>			}<br>	}<br>}<br>main()<br>{<br>	char fileData[1000];<br>	char compressFileData[2000];<br>	strcpy(compressFileData,"");<br>	printf("Nhap chuoi can nen:\n");<br>	fflush(stdin);<br>	gets(fileData);<br>	compressFile(fileData,compressFileData);<br>	printf("\nChuoi sau khi nen:\n");<br>	printf("%s",compressFileData);<br>}</div>]]></description>
         <enclosure url="" />
         <pubDate>2022-01-10 14:15:35 UTC</pubDate>
         <guid>https://padlet.com/minhloi1131130/uhkpff4qy751uzwf/wish/1983895220</guid>
      </item>
      <item>
         <title>Minh họa thuật toán </title>
         <author>khoana23062002</author>
         <link>https://padlet.com/minhloi1131130/uhkpff4qy751uzwf/wish/1983901628</link>
         <description><![CDATA[]]></description>
         <enclosure url="https://padlet-uploads.storage.googleapis.com/1254537598/222ecee3e456c72142cc9caa6e6fef9f/ewrrhtrtyyuyilui.jpg" />
         <pubDate>2022-01-10 14:18:02 UTC</pubDate>
         <guid>https://padlet.com/minhloi1131130/uhkpff4qy751uzwf/wish/1983901628</guid>
      </item>
   </channel>
</rss>
