词频统计 C代码.docx





《词频统计 C代码.docx》由会员分享,可在线阅读,更多相关《词频统计 C代码.docx(3页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、词频统计排序统计英文文献中的词频,并排序作业单词统计局部采用字典树的方法将单词分类并统计,然后采用字典树的遍历将字典 树统计的字符按顺序拼接并将词频读出统一存入数组中,最后采用冒泡排序的方法将数组中 的词频按从小到大的顺序排列并输出到文件中。源代码:include include #include define MAX 27/26 个字母和,字典树的结构体定义typedef struct Word(Word*nextMAX; 数组下标525代表小写字母,26 int num;);结构体定义:单词和对应频率typedef struct tlist(char word200;int time;);
2、struct tlist list(3000000;Word *root;charstr2OO=;char tempword1000;int size=0;新建单词的函数void createWord(char *str)(int len = strlen(str), id;Word *p = root, *q;for(int i = 0; i = a & stri = A & stri nextid = NULL)假设已到达链表结尾,开辟新的结构体存入字母 q = (Word *)malloc(sizeof(Word);for(int j = 0; j num=O;q-nextj = NUL
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 词频统计 C代码 词频 统计 代码

限制150内