文本: a b c a c a d b a c d a b a a c b a b a 传统表示方法:a: 00, b: 01, c: 10, d: 11 传统表示未压缩时: 0001100010001101001011001000001001001000 统计次数:a:9, b:5, c:4, d:2 前缀码表示:a: 0, b: 10, c:110, d:111 压缩后: 0101100110011110011011101000110100100
#include #include #include using namespace std; #define NULL 0 int const MAX_NUM=20; #define LEN sizeof(struct shortage) //定义一个仓管管理信息的结构体 struct date { int year; int month; int day; }; struct shortage { int number; char tile[MAX_NUM]; int quantity;