一 . 需求分析: 1) 输入形式和输入值范围: 输入形式是要压缩(或者要解压)的文件路径,输入范围是字符串,而且要是文件的路径。 2) 输出形式: 输出相应的编码压缩文件和解码原文件 3) 程序所能达到的功能: 利用哈夫曼对ASCII文件做不等长编码,达到压缩文件。利用哈夫曼树的遍历,达到解压文件的目的。程序的功能也就是实现压缩和解压ASCII类型文件的目的。 4)测试数据:(包括正确的输入数据及其输出结果和含有错误输入及其输出结果) 测试输入或者输出文本框是不是有空的,是不是不是有效路径。进行条件判断,实现错误处理。 比如要压缩:c:\a.txt 文件路径就是:c:\a.txt。如果输入框是空的,就判断,然后用MessageBox处理信息。 如果文件路径和文件的输出路径都写正确的话,就会输出相应的压缩或者解压文件,否则用函数MessageBox提示错误。然后进行更正。 二 . 概要设计: 1) 哈夫曼树的特点 a) 是二叉树的一种,而且是一种没有度数是1的二叉树 b) 一棵树有n个叶子,就会用2n-1个节点 c) 一种“最优”二叉树,由于树的带权路径(WPL)最小 d) 由于它是由下到上顺序构造的,使得分支节点和叶子节点从下到上,权值都是从小到大的顺序排列的
上传时间: 2013-12-03
上传用户:zsjzc
高斯列主元消去法,计算方法实现,已编译通过。使用例子 3x1+2x2+2x3+3x4=2.5 5x1+2x2+3x3+4x4=2.5 2x1+2x2+x3+2x4=2 3x1+x2+3x3+2x4=1.5 输入N=4,A={3 2 2 3 5 2 3 4 2 2 1 2 3 1 3 2},B={2.5 2.5 2 1.5}
标签: 高斯
上传时间: 2015-12-23
上传用户:yan2267246
Java 版本的 PHP serialize/unserialize 完整实现。目前实现了对各种基本类型、数组、ArrayList、HashMap、和其它可序列化对象的序列化。实现了 PHP 5 中的Serializable 接口的支持。实现了 PHP 中的 __sleep 和 __wakeup 魔术方法的支持。实现了对所有标示(N、b、i、d、s、a、O、R、r、U、C)的反序列化,在对标示 a 反序列化时,可以根据下标和值来自动判断是 ArrayList 还是 HashMap。并且在反序列化时可以强制指定反序列化的类型。该类是静态类,无需也不能被实例化。除了包含了 serialize 和 unserialize 方法以外,还增加了一个 cast 方法,用来进行反序列化后的类型转换,该方法主要用于将反序列化后的 ArrayList 转化为数组或者 HashMap。
标签: unserialize ArrayList PHP serialize
上传时间: 2016-01-06
上传用户:奇奇奔奔
给出一个分治算法,计算两个n 位大整数的乘积。即A*B.并给出你的算法的复杂度分析。
上传时间: 2016-01-26
上传用户:磊子226
How the K-mean Cluster work Step 1. Begin with a decision the value of k = number of clusters Step 2. Put any initial partition that classifies the data into k clusters. You may assign the training samples randomly, or systematically as the following: Take the first k training sample as single-element clusters Assign each of the remaining (N-k) training sample to the cluster with the nearest centroid. After each assignment, recomputed the centroid of the gaining cluster. Step 3 . Take each sample in sequence and compute its distance from the centroid of each of the clusters. If a sample is not currently in the cluster with the closest centroid, switch this sample to that cluster and update the centroid of the cluster gaining the new sample and the cluster losing the sample. Step 4 . Repeat step 3 until convergence is achieved, that is until a pass through the training sample causes no new assignments.
标签: the decision clusters Cluster
上传时间: 2013-12-21
上传用户:gxmm
用C++中的MFC编程实现正轴等角割圆柱投影,实现以下要求: 取克拉索夫斯基椭球 (1)制图区域: Bs=0°, BN=25° LE=105°, LE=125° (2)经纬线间隔: ΔB=ΔL=5° (3)制图比例尺: 1:M0=1:1000 000 (4)标准纬线: Bk=±15° 计算经纬网格点的 x, y,m,n, p
上传时间: 2013-12-29
上传用户:himbly
编写具有如下函数原型的递归与非递归两种函数equ,负责判断数组a与b的前n个元素值是否按下标对应完全相同,是则返回true,否则返回false。并编制主函数对它们进行调用,以验证其正确性。 bool equ(int a[], int b[], int n) 提示:递归函数中可按如下方式来分解并处理问题,先判断最后一个元素是否相同,不同则返false;相同则看n是否等于1,是则返回true,否则进行递归调用(传去实参a、b与 n-1,去判断前n-1个元素的相等性),并返回递归调用的结果(与前n-1个元素的是否相等性相同)。
上传时间: 2013-12-03
上传用户:梧桐
Generate 100 samples of a zero-mean white noise sequence with variance , by using a uniform random number generator. a Compute the autocorrelation of for . b Compute the periodogram estimate and plot it. c Generate 10 different realizations of , and compute the corresponding sample autocorrelation sequences , and . Compute the average autocorrelation sequence as and the corresponding periodogram for . d Compute and plot the average periodogram using the Bartlett method. e Comment on the results in parts (a) through (d).
标签: zero-mean Generate sequence variance
上传时间: 2016-03-04
上传用户:朗朗乾坤
数据结构 1、算法思路: 先定义一个三元组,创建稀疏矩阵m和n。依次扫描A和B的行号和列号,若A的当前项的行号等于B的当前项的行号,则比较其列号,将较小列的项存入C中,如果列号也相等,则将对应的元素值相加后存入C中;若A的当前项的行号小于B的当前项的行号,则将A的项存入C中;若A的当前项的行号大于B的当前项的行号,则将B的项存入C中。
上传时间: 2016-03-05
上传用户:dyctj
编程题(15_01.c) 结构 struct student { long num char name[20] int score struct student *next } 链表练习: (1).编写函数struct student * creat(int n),创建一个按学号升序排列的新链表,每个链表中的结点中 的学号、成绩由键盘输入,一共n个节点。 (2).编写函数void print(struct student *head),输出链表,格式每行一个结点,包括学号,姓名,分数。 (3).编写函数struct student * merge(struct student *a,struct student *b), 将已知的a,b两个链表 按学号升序合并,若学号相同则保留成绩高的结点。 (4).编写函数struct student * del(struct student *a,struct student *b),从a链表中删除b链表中有 相同学号的那些结点。 (5).编写main函数,调用函数creat建立2个链表a,b,用print输出俩个链表;调用函数merge升序合并2个 链表,并输出结果;调用函数del实现a-b,并输出结果。 a: 20304,xxxx,75, 20311,yyyy,89 20303,zzzz,62 20307,aaaa,87 20320,bbbb,79 b: 20302,dddd,65 20301,cccc,99 20311,yyyy,87 20323,kkkk,88 20307,aaaa,92 20322,pppp,83
上传时间: 2016-04-13
上传用户:zxc23456789