【问题描述】
设计一个利用哈夫曼算法的编码和译码系统,重复地显示并处理以下项目,直到选择退出为止。
【基本要求】
(1)初始化:键盘输入字符集大小n、n个字符和n个权值,建立哈夫曼树;
(2)编码:利用建好的哈夫曼树生成哈夫曼编码;
(3)输出编码;
(4)设字符集及频度如下表:
字符:A B C D E F
频度:4 9 23 2 17 15
字符:G H I J K
频度:1 2 3 3 4
SHOW FULL COLUMNS FROM `jrk_downrecords` [ RunTime:0.001003s ]
SELECT `a`.`aid`,`a`.`title`,`a`.`create_time`,`m`.`username` FROM `jrk_downrecords` `a` INNER JOIN `jrk_member` `m` ON `a`.`uid`=`m`.`id` WHERE `a`.`status` = 1 GROUP BY `a`.`aid` ORDER BY `a`.`create_time` DESC LIMIT 10 [ RunTime:0.074824s ]
SHOW FULL COLUMNS FROM `jrk_tagrecords` [ RunTime:0.000913s ]
SELECT * FROM `jrk_tagrecords` WHERE `status` = 1 ORDER BY `num` DESC LIMIT 20 [ RunTime:0.001107s ]
SHOW FULL COLUMNS FROM `jrk_member` [ RunTime:0.000980s ]
SELECT `id`,`username`,`userhead`,`usertime` FROM `jrk_member` WHERE `status` = 1 ORDER BY `usertime` DESC LIMIT 10 [ RunTime:0.003122s ]
SHOW FULL COLUMNS FROM `jrk_searchrecords` [ RunTime:0.001035s ]
SELECT * FROM `jrk_searchrecords` WHERE `status` = 1 ORDER BY `num` DESC LIMIT 5 [ RunTime:0.003826s ]
SELECT aid,title,count(aid) as c FROM `jrk_downrecords` GROUP BY `aid` ORDER BY `c` DESC LIMIT 10 [ RunTime:0.014679s ]
SHOW FULL COLUMNS FROM `jrk_articles` [ RunTime:0.001125s ]
UPDATE `jrk_articles` SET `hits` = 2 WHERE `id` = 460000 [ RunTime:0.018666s ]