CSIS 1119B/C Introduction to Data Structures and Algorithms
CSIS 1119B/C Introduction to Data Structures and Algorithms
Programming Assignment Two
Due Date: 18 Apr 2019 (Thu) 23:59
You are required to write a Huffman code encoder.
Details:
Name your program as “hmencoder”.
Usage of hmencoder:
hmencoder [input_file]
where input_file is the file containing the input message.
The input message contains normal English text. You need to encode all English letters together with all printable characters such as “.”, “;”, “!”, space etc. The capital letter and the corresponding small letter are treated as two symbols. For example, “A” and “a” are regarded as two symbols.
The output of hmencoder should have two output files, “code.txt” and “encodemsg.txt”.
The output file “code.txt” stores the codewords for each symbol and the average number of bits used for each symbol. The format of this output file is as follows:
代做CSIS 1119B/C作业、代写Data Structures作业、代做Java程序语言作业、代写c/c++,Python实验作业
Each row contains the codeword for a separate symbol, the symbols are listed according to the increasing order of the corresponding ASCII code value. The last row shows the average number of bits used for each symbol.
E.g.
Space: 000
!: 001
...............
A: 0100
...............
z: 1000
Ave = 3.43 bits per symbol
The output file “encodemsg.txt” stores the encoded message with 80 0/1 characters on each row (except the last row).
*Important*: (i) We use the letter with the smallest ASCII code as the representative of a subtree; and (ii) in case of ambiguity, select the two trees with the smallest representatives and when combining the two trees, the one with the smaller representative will be on the left.
A sample input file and the corresponding output files will be given in the course moodle page soon.
Hand in the following (via Moodle):
-The source code and the executable of your program (also specify clearly the environment for which your program can be executed at the beginning of your source code as comments. Failing to do so may receive 0 marks even your program is correct.)
因为专业,所以值得信赖。如有需要,请加QQ:99515681 或邮箱:99515681@qq.com
微信:codinghelp
CSIS 1119B/C Introduction to Data Structures and Algorithms的更多相关文章
- CSC 172 (Data Structures and Algorithms)
Project #3 (STREET MAPPING)CSC 172 (Data Structures and Algorithms), Spring 2019,University of Roche ...
- Basic Data Structures and Algorithms in the Linux Kernel--reference
http://luisbg.blogalia.com/historias/74062 Thanks to Vijay D'Silva's brilliant answer in cstheory.st ...
- [Data Structures and Algorithms - 1] Introduction & Mathematics
References: 1. Stanford University CS97SI by Jaehyun Park 2. Introduction to Algorithms 3. Kuangbin' ...
- 剪短的python数据结构和算法的书《Data Structures and Algorithms Using Python》
按书上练习完,就可以知道日常的用处啦 #!/usr/bin/env python # -*- coding: utf-8 -*- # learn <<Problem Solving wit ...
- 6-1 Deque(25 分)Data Structures and Algorithms (English)
A "deque" is a data structure consisting of a list of items, on which the following operat ...
- 学习笔记之Problem Solving with Algorithms and Data Structures using Python
Problem Solving with Algorithms and Data Structures using Python — Problem Solving with Algorithms a ...
- The Swiss Army Knife of Data Structures … in C#
"I worked up a full implementation as well but I decided that it was too complicated to post in ...
- Persistent Data Structures
原文链接:http://www.codeproject.com/Articles/9680/Persistent-Data-Structures Introduction When you hear ...
- Algorithms & Data structures in C++& GO ( Lock Free Queue)
https://github.com/xtaci/algorithms //已实现 ( Implemented ): Array shuffle https://github.com/xtaci/al ...
随机推荐
- POJ 1251 Jungle Roads (最小生成树)
题目: Description The Head Elder of the tropical island of Lagrishan has a problem. A burst of foreign ...
- python开发环境_windows系统安装_错误记录
1 安装python编译器2.7.11版本 (安装包自带pip,setuptools,依赖,会将pip,setuptools安装到自己的类库中) 配置环境变量: 配置python_home,然后加入p ...
- 20175312 2018-2019-2 《Java程序设计》结对编程练习_四则运算(第一周:阶段性总结)
20175312 2018-2019-2 <Java程序设计>结对编程练习_四则运算(第一周:阶段性总结) 结对对象与其博客链接 20175309 刘雨恒:https://www.cnbl ...
- arraylist 为什么 删除元素时要使用迭代器而不能使用遍历
因为你要是遍历了,arraylist 的长度就变了,容易数组越界和下标问题 public class Test { public static void main(String[] args) ...
- elasticsearch5.5.3 源码学习 idea下源码编译
1.学习elasticsearch 源码,通过搜索“elasticsearch源码”,进行相关搜索. 2.因源码gradle编译,选择gradle-3.5可以编译通过,对应elasticsearc ...
- 浅析uWSGI、uwsgi、wsgi
WSGI协议 首先弄清下面几个概念: WSGI:全称是Web Server Gateway Interface,WSGI不是服务器,python模块,框架,API或者任何软件,只是一种规范,描述web ...
- Flex核心属性整理
main axis和cross axis的位置不一定是水平和垂直的,以flex-direction的值即为主轴方向 justify-content:主轴对齐方式 space-between:将多余空间 ...
- Go语言基础(一)
Go语言基础(一) 国庆体验一下大名鼎鼎的Go语言,IDE使用IEDA+Go插件,边敲代码边体会,感觉Go语言好酷 一.Hello World 和Java类似,go文件需要一个package包含,代码 ...
- JS基础学习1
1 JS 概述 一个完整的javascript实现是由以下3个不同部分组成的: (1) 核心(ECMAscript) (2) 文档对象模型(DOM) Document object ...
- Mac_安装Homebrew以及Maven
Mac OSX上的软件包管理工具,安装软件或者卸载软件. 打开终端输入(如不行,可参考homebrew官网): ruby -e "$(curl -fsSL https://raw.githu ...