资源简介
虚拟机的设计与实现CC++(源代码和书籍)
代码片段和文件信息
#include
#include
#include
#define TRUE 1
#define FALSE 0
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ declarations +
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
struct HashTbl
{
unsigned char empty; /*indicates if entry is used or not*/
char str[32]; /*string payload*/
struct HashTbl *left;
struct HashTbl *right;
};
#define PRIME 5
class HashTable
{
struct HashTbl hashTbl[PRIME]; /*the hash table itself*/
int hashpjw(char *s);
/*binary tree routines needed for collision resoltuion*/
struct HashTbl* findNode(struct HashTbl* link char *val);
void insertNode(struct HashTbl** link char *val);
void printTree(struct HashTbl* link int level);
void deleteAll(struct HashTbl **link);
public:
HashTable();
~HashTable();
struct HashTbl* queryHashTbl(char *str);
void addHashTblEntry(char *val);
void printHashTbl();
};
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ definitions +
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
HashTable::HashTable()
{
int i;
for(i=0;i {
hashTbl[i].empty = TRUE;
hashTbl[i].str[0]=‘\0‘;
}
return;
}/*end constructor*/
/*-----------------------------------------------------------------*/
HashTable::~HashTable()
{
int i;
for(i=0;i {
deleteAll(&(hashTbl[i].left));
deleteAll(&(hashTbl[i].right));
}
return;
}/*end destructor*/
/*-----------------------------------------------------------------*/
/*
if symbol exists in hash table we get a pointer to the node
if a symbol does not exist in the hash table we get NULL
*/
struct HashTbl* HashTable::queryHashTbl(char *str)
{
int hash;
hash = hashpjw(str);
if(hashTbl[hash].empty==TRUE)
{
return(NULL);
}
return(findNode(&(hashTbl[hash]) str));
}/*end queryHashTbl*/
/*-----------------------------------------------------------------*/
void HashTable::addHashTblEntry(char *val)
{
struct HashTbl *ptr;
int hash;
hash = hashpjw(val);
printf(“HashTable.addHashTblEntry(): hash(%s)=%d\n“valhash);
if(hashTbl[hash].empty==TRUE)
{
hashTbl[hash].empty=FALSE;
strcpy(hashTbl[hash].strval);
hashTbl[hash].left = NULL;
hashTbl[hash].right = NULL;
return;
}
ptr = &hashTbl[hash];
insertNode(&ptr val);
return;
}/*end addHashTblEntry*/
/*-----------------------------------------------------------------*/
void HashTable::printHashTbl()
{
int i;
for(i=0;i {
if(hashTbl[i].empty == FALSE)
{
printf(“--Hash Slot (%d)--\n“i);
printTree(&(hashTbl[i]) 0);
printf(“\n“);
}
}
printf(“\n“);
return;
}/*end printHashTbl*/
/*-----------------------------------------------------
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 15824 2001-05-05 10:42 虚拟机的设计与实现CC++(源代码和书籍)\源码\linux\bin\filedmp
文件 92938 2001-05-05 10:42 虚拟机的设计与实现CC++(源代码和书籍)\源码\linux\bin\hashtbl
文件 181308 2001-05-05 10:42 虚拟机的设计与实现CC++(源代码和书籍)\源码\linux\bin\hasm
文件 114414 2001-05-05 10:42 虚拟机的设计与实现CC++(源代码和书籍)\源码\linux\bin\hecvm
文件 90869 2001-05-05 10:42 虚拟机的设计与实现CC++(源代码和书籍)\源码\linux\bin\list
文件 7289 2001-05-05 10:42 虚拟机的设计与实现CC++(源代码和书籍)\源码\linux\bin\numfmt
文件 16306 2001-05-05 10:42 虚拟机的设计与实现CC++(源代码和书籍)\源码\linux\bin\rawbin
文件 7702 2001-05-05 10:42 虚拟机的设计与实现CC++(源代码和书籍)\源码\linux\bin\tree
文件 952 2001-05-05 10:41 虚拟机的设计与实现CC++(源代码和书籍)\源码\linux\bldall.sh
文件 6945 2001-05-05 10:41 虚拟机的设计与实现CC++(源代码和书籍)\源码\linux\dstruct\hashtbl\hashtbl.cpp
文件 42 2001-05-05 10:41 虚拟机的设计与实现CC++(源代码和书籍)\源码\linux\dstruct\hashtbl\makefile
文件 2696 2001-05-05 10:41 虚拟机的设计与实现CC++(源代码和书籍)\源码\linux\dstruct\list\list.cpp
文件 33 2001-05-05 10:41 虚拟机的设计与实现CC++(源代码和书籍)\源码\linux\dstruct\list\makefile
文件 33 2001-05-05 10:41 虚拟机的设计与实现CC++(源代码和书籍)\源码\linux\dstruct\tree\makefile
文件 6094 2001-05-05 10:41 虚拟机的设计与实现CC++(源代码和书籍)\源码\linux\dstruct\tree\tree.cpp
文件 9081 2001-05-05 10:41 虚拟机的设计与实现CC++(源代码和书籍)\源码\linux\hasm\bldfile.cpp
文件 8096 2001-05-05 10:41 虚拟机的设计与实现CC++(源代码和书籍)\源码\linux\hasm\cmdline.cpp
文件 536 2001-05-05 10:41 虚拟机的设计与实现CC++(源代码和书籍)\源码\linux\hasm\common.c
文件 1379 2001-05-05 10:41 虚拟机的设计与实现CC++(源代码和书籍)\源码\linux\hasm\error.c
文件 7621 2001-05-05 10:41 虚拟机的设计与实现CC++(源代码和书籍)\源码\linux\hasm\exenv.c
文件 1339 2001-05-05 10:41 虚拟机的设计与实现CC++(源代码和书籍)\源码\linux\hasm\globvar.cpp
文件 9635 2001-05-05 10:41 虚拟机的设计与实现CC++(源代码和书籍)\源码\linux\hasm\hashtbl.cpp
文件 2793 2001-05-05 10:41 虚拟机的设计与实现CC++(源代码和书籍)\源码\linux\hasm\iset.c
文件 755 2001-05-05 10:41 虚拟机的设计与实现CC++(源代码和书籍)\源码\linux\hasm\label.cpp
文件 22823 2001-05-05 10:41 虚拟机的设计与实现CC++(源代码和书籍)\源码\linux\hasm\linetok.cpp
文件 11493 2001-05-05 10:41 虚拟机的设计与实现CC++(源代码和书籍)\源码\linux\hasm\linux.c
文件 7454 2001-05-05 10:41 虚拟机的设计与实现CC++(源代码和书籍)\源码\linux\hasm\lnscan.cpp
文件 4538 2001-05-05 10:41 虚拟机的设计与实现CC++(源代码和书籍)\源码\linux\hasm\main.cpp
文件 50 2001-05-05 10:41 虚拟机的设计与实现CC++(源代码和书籍)\源码\linux\hasm\makefile
文件 23385 2001-05-05 10:41 虚拟机的设计与实现CC++(源代码和书籍)\源码\linux\hasm\pass1.cpp
............此处省略202个文件信息
- 上一篇:C++ Primer第5版顶级清晰文字版
- 下一篇:c程序设计第四版pdf
相关资源
- c++飞机大战 源代码+程序
- 分形算法与程序设计_VC++实现电子书源
- VC++ OPENCV CT简单重建实现及PPT
- Visual C++数字图像处理开发入门与编程
- COM编程精彩+光盘(源代码
- 数据结构与算法分析.C++语言描述 第四
- VC++下的语音识别源代码
- VC++深入详解(完整版)+所有源代码集
- H264 TS打包C语言源代码
- C++ 经典泡泡龙源代码
- 精通MATLAB与C&C++混合程序设计第3版源
- C++图像处理系统源代码
- 《数值分析》(Numerical Recipes)3rd E
- C++结合Qt库编写的背单词软件源代码
- Numerical.Recipes.C++数值算法 第二版中文
- c++串口读写源代码
- 精通Visual C++数字图像处理技术与工程
- 《Visual+C%2B%2B+6.0+时尚编程百例》100个
- 病毒Phatbot的C++源代码
- c++基于Windows编程的打飞机小游戏源代
- Cppcheck源代码
- c++课程设计-----股票交易系统源代码
- Visual C++视频技术方案宝典的光盘源代
- 计算机图形学实践教程随书源代码
- 上期CTP_API_C++可实盘多合约多策略版本
- 上期CTP_API_C++可实盘多合约多策略版本
- 孔令德 计算机图形学基础教程visual
- Essential C++中文版+完整源代码+习题答
- C++学习实用实践项目源代码
- Visual C++实践与提高-COM和COM+篇高清p
评论
共有 条评论