资源简介

C语言实现赫夫曼树的构建及赫夫曼编码的源代码,帮助你掌握Huffman编码的算法实现。赫夫曼树的建立,及实现其编码,和数据结构教材上的算法同步。基于C语言,模拟赫夫曼树的构造并对之进行编码。代码简洁,附报告书说明,有利于对数据结构赫夫曼树的理解。适合数据结构初中级学者学习。

资源截图

代码片段和文件信息

/**********************************************/
/*                                            */
/*        “赫夫曼编码编译器“                  */
/*                                            */
/*    计08-3班  NO.1 studio 工作室            */
/*    成员:                                  */
/*         组长: 丁梽豪                      */
/*         组员: 陈  璐                      */
/*                吴晓莹                      */
/*                                            */
/**********************************************/

#include 
#include  
#include “bios.h“
#include “ctype.h“
#include “conio.h“
#include “stdlib.h“

void initgr(void)      /* BGI初始化 */
{
  int gd = DETECT gm = 0; /* 和gd = VGAgm = VGAHI是同样效果 */
  registerbgidriver(EGAVGA_driver);/* 注册BGI驱动后可以不需要.BGI文件的支持运行 */
  initgraph(&gd &gm ““);
}

void drawmat(char *matint matsizeint xint yint color)

{
  int i j k n;
  n = (matsize - 1) / 8 + 1;
  for(j = 0; j < matsize; j++)
    for(i = 0; i < n; i++)
      for(k = 0;k < 8; k++)
        if(mat[j * n + i] & (0x80 >> k))
          putpixel(x + i * 8 + k y + j color);
}

char he64S[]={
/* 以下是 ‘赫‘ 的 64点阵宋体 字模,512 byte */
  0x000x000x000x000x000x000x000x00
  0x000x000x000x000x000x000x000x00
  0x000x000x000x000x000x000x000x00
  0x000x000x400x000x000x080x000x00
  0x000x000x700x000x000x0E0x000x00
  0x000x000x7C0x000x000x0F0x000x00
  0x000x000x780x000x000x0E0x000x00
  0x000x000x700x000x000x0E0x000x00
  0x000x000x700x000x000x0E0x000x00
  0x000x000x700x000x000x0E0x000x00
  0x000x000x700x000x000x0E0x000x00
  0x000x000x700x000x000x0E0x020x00
  0x000x000x700x180x000x0E0x070x00
  0x000x000x700x3C0x000x0E0x0F0x80
  0x010xFF0xFF0xFE0x3F0xFF0xFF0xC0
  0x000x800x700x000x000x0E0x000x00
  0x000x000x700x000x000x0E0x000x00
  0x000x000x700x000x000x0E0x000x00
  0x000x000x700x000x000x0E0x000x00
  0x000x000x700x000x000x0E0x000x00
  0x000x000x700x000x000x0E0x000x00
  0x000x000x700x000x000x0E0x000x00
  0x000x000x700x180x000x0E0x000xC0
  0x000x000x700x3C0x000x0E0x010xE0
  0x0F0xFF0xFF0xFF0xFF0xFF0xFF0xF0
  0x070xC30xFF0x000x600xE00xC00x00
  0x000x030x870x000x000xE00xC00x00
  0x000x030x870x000x000xE00xC00x00
  0x000x030x070x000x000xE00xC00x00
  0x000x030x070x000x000xE00xC00x00
  0x000x030x070x000x000xE00xC00x00
  0x000xC30x070x400x000xE00xC00x00
  0x000xE70x070x600x200xE00xC00x00
  0x000xFF0x070x300x380xE00xD00x00
  0x010xE70x070x380x3E0xE00xCC0x00
  0x010xC70x070x1C0x380xE00xC60x00
  0x010xC70x070x1C0x780xE00xC70x00
  0x030x870x070x1E0x700xC00xC30x80
  0x030x870x070x0E0x700xC00xC30xC0
  0x070x070x070x0E0xE10xC00xC10xE0
  0x060x060x070x0C0xE10xC00xC00xE0

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2018-10-31 13:40  Huffman_Tree\
     文件       31798  2010-11-29 13:26  Huffman_Tree\Huffman_Tree.c
     目录           0  2018-10-31 13:40  __MACOSX\
     目录           0  2018-10-31 13:40  __MACOSX\Huffman_Tree\
     文件         230  2010-11-29 13:26  __MACOSX\Huffman_Tree\._Huffman_Tree.c
     文件      110229  2018-07-29 19:30  Huffman_Tree\WechatIMG2.jpeg
     文件         266  2018-07-29 19:30  __MACOSX\Huffman_Tree\._WechatIMG2.jpeg
     文件      356864  2009-12-16 14:12  Huffman_Tree\鎶ュ憡.doc
     文件         230  2009-12-16 14:12  __MACOSX\Huffman_Tree\._鎶ュ憡.doc
     文件         194  2018-10-31 13:40  __MACOSX\._Huffman_Tree

评论

共有 条评论