我一直很喜欢用标准库,非常非常方便。但是有时候你根本不知道它为你做了什么,我喜欢知道自己写的程序每一步都干了什么!!!
////////////////////////////////// ///////////////////////////////// //标准模板库 ////////////////////////////////// /* #include <time.h> #include <map> #include <string> #include <fstream> #include <iostream> using namespace std; int main() { double beginTime = clock(); ifstream in("source.txt"); map<string, int> M; map<string, int>::iterator j; string t; while( in >> t ) { M[t]++; } for ( j = M.begin(); j != M.end(); j++) { cout << j->first << " " << j->second << endl; } double endTime = clock(); cout << "time: " << endTime - beginTime << "ms " << endl; return 0; } */ ////////////////////////////////// ///////////////////////////////// // 编程珠玑十五章,珍珠字符串 //用Hash表实现之 ////////////////////////////////// /* #include <time.h> #include <stdio.h> #include <string.h> #include <stdlib.h> #define NHASH 29989 #define MULT 31 typedef struct node *nodeptr; typedef struct node { char *word; int count; nodeptr next; }node; nodeptr bin[NHASH]; unsigned int hash( char *p) { unsigned int h = 0; for( ; *p; p++) { h = MULT * h + *p; } return h % NHASH; } void incword( char *s) { int h = hash( s ); nodeptr p = NULL; for ( p = bin[h]; p != NULL; p = p->next) { if ( strcmp( s, p->word) == 0) { p->count ++; return; } } p = NULL; p = new node; if ( p == NULL) { return; } p->count = 1; p->word = new char[ strlen(s) + 1]; strcpy( p->word, s); p->next = bin[h]; bin[h] = p; } int main() { double beginTime = clock(); int i = 0; FILE *fp = NULL; fp = fopen("source.txt","r"); if ( fp == NULL ) { printf("文件打开错误"); return 1; } //ifstream in("source.txt"); for ( i = 0; i < NHASH; i++) { bin[i] = NULL; } char tempWord[100]; while( fscanf(fp, "%s", tempWord) != EOF ) { incword( tempWord ); } nodeptr p = NULL; for ( i = 0; i < NHASH; i++) { p = NULL; for ( p = bin[i]; p != NULL; p = p->next) { //cout << p->word<< " " << p->count << endl; printf("%s %d\n", p->word, p->count); } } double endTime = clock(); printf("time:%g ms", endTime - beginTime ); return 0; } */ #include <stdio.h> #include <string.h> #include <stdlib.h> #include <time.h> typedef struct node *nodeptr; typedef struct node { char *word; int count; nodeptr lchild; nodeptr rchild; }node; nodeptr setUp( nodeptr root, char *s) { if ( root == NULL ) { root = (nodeptr)malloc( sizeof(node)); root->word = (char *)malloc(strlen(s) + 1); strcpy( root->word, s); root ->lchild = NULL; root ->rchild = NULL; root->count = 1; return root; } int flag = strcmp( root->word, s); if( !flag) { root ->count ++; return root; } else if ( flag < 0 ) { root ->rchild = setUp( root->rchild, s); } else { root->lchild = setUp(root->lchild, s); } return root; } void Traverse( nodeptr root) { if ( root != NULL) { if ( root->rchild != NULL) { Traverse(root->rchild); } printf("%s %d\n", root->word, root->count); if ( root->lchild != NULL) { Traverse(root->lchild); } } return ; } int main() { nodeptr root = NULL; double beginTime = clock(); int i = 0; FILE *fp = NULL; fp = fopen("source.txt","r"); if ( fp == NULL ) { printf("文件打开错误"); return 1; } char tempWord[100]; while( fscanf(fp, "%s", tempWord) != EOF ) { root = setUp(root, tempWord ); } Traverse(root); double endTime = clock(); printf("time:%g ms", endTime - beginTime ); return 0; }
您还没有登录,请您登录后再发表评论
前端开源库-copy-webpack-plugin-hash复制Webpack插件哈希,使用Webpack复制文件和目录
赠送jar包:shiro-crypto-hash-1.4.0.jar; 赠送原API文档:shiro-crypto-hash-1.4.0-javadoc.jar; 赠送源代码:shiro-crypto-hash-1.4.0-sources.jar; 赠送Maven依赖信息文件:shiro-crypto-hash-1.4.0.pom; ...
Jemter测试MQ的插件 JMeter-Rabbit-AMQP在github上17年便停止更新了,不支持rabbitmq的交换机类型“x-consistent-hash”,为此我更改了源码使其支持"x-consistent-hash
数据结构(字符串匹配,hash,二叉树)训练 数据结构(字符串匹配,hash,二叉树)训练
IT笔试面试--链地址Hash表的代码实现,运行正确+详细注释,链地址Hash是最常用的Hash算法。
前端开源库-folder-hash文件夹哈希,在文件夹及其内容上创建哈希校验和-其子级及其内容
前端开源库-key-hash键哈希,将字符串转换为数字的非常简单的哈希
毕业论文-于基hash表的班级成员管理数据结构课程设计.doc
前端开源库-quick-hash快速散列,杂音散列优化性能,而不是碰撞避免。
Hash-Hash-Hash
内容描述:用于crypto中hash爆破的强大工具。 优势:相较于其他hash工具,具有更快的算力,使用方便简洁。 适用:适用于md5,sha256等典型hash加密方式,反推出所需的源码。
前端开源库-is-quick-hash是快速哈希,检查字符串是否像由快速哈希生成的哈希
前端开源库-http-hash-mockerHTTP哈希模拟程序,使用HTTP哈希创建模拟数据
前端开源库-happn-password-hash-and-salthappn密码散列和salt,node.js的简单、安全和直接密码散列/salt
前端开源库-pretty-hash漂亮的哈希,输出二进制缓冲区作为一个漂亮的缩短的十六进制字符串
先用Hash表存储c语言中32个关键字,再扫描c源程序取出每个单词,利用Hash查找技术统计该程序中的关键字出现的频度。发生Hash冲突用线性探测法解决。设Hash函数为: Hash(key)=[(key的第一个字母序号)*100+(key的...
Go语言开发的基于DRH(Deep-Re-Hash)深度哈希分区算法的高性能Key-Value嵌入式数据库
扫描一个C源程序,用Hash表存储该程序中出现的关键字,并统计该程序中的关键字出现的度。用线性探测法解决Hash冲突。设Hash函数为:Hash(Key)=[(Key的首字母序号)*100+(Key的尾字母序号)] Mod 41。关键字39个,参考...
pass-the-hash attack theory and implementation
相关推荐
前端开源库-copy-webpack-plugin-hash复制Webpack插件哈希,使用Webpack复制文件和目录
赠送jar包:shiro-crypto-hash-1.4.0.jar; 赠送原API文档:shiro-crypto-hash-1.4.0-javadoc.jar; 赠送源代码:shiro-crypto-hash-1.4.0-sources.jar; 赠送Maven依赖信息文件:shiro-crypto-hash-1.4.0.pom; ...
Jemter测试MQ的插件 JMeter-Rabbit-AMQP在github上17年便停止更新了,不支持rabbitmq的交换机类型“x-consistent-hash”,为此我更改了源码使其支持"x-consistent-hash
数据结构(字符串匹配,hash,二叉树)训练 数据结构(字符串匹配,hash,二叉树)训练
IT笔试面试--链地址Hash表的代码实现,运行正确+详细注释,链地址Hash是最常用的Hash算法。
赠送jar包:shiro-crypto-hash-1.4.0.jar; 赠送原API文档:shiro-crypto-hash-1.4.0-javadoc.jar; 赠送源代码:shiro-crypto-hash-1.4.0-sources.jar; 赠送Maven依赖信息文件:shiro-crypto-hash-1.4.0.pom; ...
前端开源库-folder-hash文件夹哈希,在文件夹及其内容上创建哈希校验和-其子级及其内容
前端开源库-key-hash键哈希,将字符串转换为数字的非常简单的哈希
毕业论文-于基hash表的班级成员管理数据结构课程设计.doc
前端开源库-quick-hash快速散列,杂音散列优化性能,而不是碰撞避免。
Hash-Hash-Hash
内容描述:用于crypto中hash爆破的强大工具。 优势:相较于其他hash工具,具有更快的算力,使用方便简洁。 适用:适用于md5,sha256等典型hash加密方式,反推出所需的源码。
前端开源库-is-quick-hash是快速哈希,检查字符串是否像由快速哈希生成的哈希
前端开源库-http-hash-mockerHTTP哈希模拟程序,使用HTTP哈希创建模拟数据
前端开源库-happn-password-hash-and-salthappn密码散列和salt,node.js的简单、安全和直接密码散列/salt
前端开源库-pretty-hash漂亮的哈希,输出二进制缓冲区作为一个漂亮的缩短的十六进制字符串
先用Hash表存储c语言中32个关键字,再扫描c源程序取出每个单词,利用Hash查找技术统计该程序中的关键字出现的频度。发生Hash冲突用线性探测法解决。设Hash函数为: Hash(key)=[(key的第一个字母序号)*100+(key的...
Go语言开发的基于DRH(Deep-Re-Hash)深度哈希分区算法的高性能Key-Value嵌入式数据库
扫描一个C源程序,用Hash表存储该程序中出现的关键字,并统计该程序中的关键字出现的度。用线性探测法解决Hash冲突。设Hash函数为:Hash(Key)=[(Key的首字母序号)*100+(Key的尾字母序号)] Mod 41。关键字39个,参考...
pass-the-hash attack theory and implementation