Algorithm 版 (精华区)
发信人: lofe ()感激生活(), 信区: Algorithm
标 题: 原代码_2
发信站: 哈工大紫丁香 (Sun Sep 3 08:29:31 2000), 转信
void DeleteNode(int p) /* Deleting node from the tree */
{
int q;
if (dad[p] == NIL)
return; /* unregistered */
if (rson[p] == NIL)
q = lson[p];
else
if (lson[p] == NIL)
q = rson[p];
else {
q = lson[p];
if (rson[q] != NIL) {
do {
q = rson[q];
} while (rson[q] != NIL);
rson[dad[q]] = lson[q];
dad[lson[q]] = dad[q];
lson[q] = lson[p];
dad[lson[p]] = q;
}
rson[q] = rson[p];
dad[rson[p]] = q;
}
dad[q] = dad[p];
if (rson[dad[p]] == p)
rson[dad[p]] = q;
else
lson[dad[p]] = q;
dad[p] = NIL;
}
/* Huffman coding parameters */
#define N_CHAR (256 - THRESHOLD + F)
/* character code (= 0..N_CHAR-1) */
#define T (N_CHAR * 2 - 1) /* Size of table */
#define R (T - 1) /* root position */
#define MAX_FREQ 0x8000
/* update when cumulative frequency */
/* reaches to this value */
typedef unsigned char uchar;
--
_______ __ ____ ________ __ __ ____ _ __
/ _____) / / / _ ] \ __ / [ ^\_/^ ] / _ ] / \ /
( (_____ / (____ / _ ] \ / [ ] [ ] / _ ] /\ \/
\_______) /_______) /_/ (_) [__] [ ] [ ] /_/ (_) / \_/
________________________________________________________/
※ 修改:.haojs 于 Sep 3 08:27:08 修改本文.[FROM: bbs.hit.edu.cn]
--
※ 转寄:.武汉白云黄鹤站 bbs.whnet.edu.cn.[FROM: bbs.hit.edu.cn]
--
☆ 来源:.哈工大紫丁香 bbs.hit.edu.cn.[FROM: haojs.bbs@bbs.whnet.]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:2.293毫秒