xxxx18一60岁hd中国/日韩女同互慰一区二区/西西人体扒开双腿无遮挡/日韩欧美黄色一级片 - 色护士精品影院www

資源簡介

數據結構相關的課程設計,實現了基于順序表、鏈表、二叉樹、哈希表的詞頻統計與檢索,僅供參考!

資源截圖

代碼片段和文件信息

//?實習.cpp?:?定義控制臺應用程序的入口點。
//
#include?“stdafx.h“
#include
#include
#include
#include
#include
#include
#include?“malloc.h“
#include?“stdlib.h“
#include
#include?
#include
using?namespace?std;
typedef?struct
{??
string?words;//儲存單詞
int?count;//記錄單詞個數后面出現幾次

}sq;
int?n=0a;
string?word[500];
sq?p[5000];
int?tr=0total=0mi=0;
void?readtxt()

{char?letter[24];

int?K;??

FILE?*fp;

char?ch;

fp=fopen(“D://InFile.txt““r“);//讀取文件,需改為你要讀取的文件的絕對路徑

while?(!feof(fp))//feof()檢測是否達到文件尾部

{ch?=?getc(fp);//獲取當前字符

if?(ch?==?‘?‘?||?ch?==?10)

{//ASCLL碼中10為換行符,此條件為遇到空格或換行則跳過

continue;

}

if?((ch?>=?‘a‘&&ch?<=?‘z‘)?||?(ch?>=?‘A‘&&ch?<=?‘Z‘))??????????????//發現一個單詞

{

K?=?0;?



while?((ch?>=?‘a‘&&ch?<=?‘z‘)?||?(ch?>=?‘A‘&&ch?<=?‘Z‘)?||?(ch?==?‘\‘‘))

{

if?(ch?>=?‘A‘&&ch?<=?‘Z‘)

ch?+=?32;//轉換成小寫

letter[K++]?=?ch;//把當前字母存入數組

ch?=?getc(fp);

}
letter[K++]?=?‘\0‘;//結束標志\0?
word[n]=letter;
//cout<n++;
}}
}
void??time(){
LARGE_INTEGER?litmp;?
LONGLONG?QPart1QPart2;?
double?dfMinusdfFreqdfTim;?
QueryPerformanceFrequency(&litmp);?
dfFreq?=?(double)litmp.QuadPart;?
QueryPerformanceCounter(&litmp);?
QPart1?=?litmp.QuadPart;?
Sleep(100)?;
QueryPerformanceCounter(&litmp);?
QPart2?=?litmp.QuadPart;
dfMinus?=?(double)(QPart2-QPart1);
dfTim?=?dfMinus/dfFreq;
dfTim*=1000000;
printf(“查找該單詞所用的時間:%lf?微秒\n“dfTim);}?
typedef?struct

{sq?*?elem;

int?length;

}sqlist;

int?partition(sqlist?&Lint?low?int?high)
{string?pivotkey;
L.elem?[0]=L.elem?[low];
pivotkey=L.elem?[0].words;
while(low{
while(lowpivotkey)?--high;
L.elem?[low]=L.elem?[high];
while(low L.elem?[high]=L.elem?[low];
}
L.elem?[low]=L.elem?[0];
return?low;
}
void?qsort(sqlist?&Lint?lowint?high)
{int?pivotloc;
if(low pivotloc=partition(Llowhigh);
qsort(Llowpivotloc-1);
qsort(Lpivotloc+1high);
}
}
void?quicksort(sqlist?&L)
{
qsort(L1L.length-1);
}
void?sortdata(sq?s[])
{
sq?e;
int?t=0pji;
while(t{
p=a;
for?(i?=?0;?i {
????????if?(word[t]?==s[i].words?)//如果有單詞相同
????????{
s[i].count?++;//則此類單詞加1
????????break;//進行下一個單詞的查找
}
}

????if?(a?==?0?||?i?==?a)//前面如果沒有相同的單詞
????{
?????s?[a].words?=word[t]?;//給此單詞分配位置
?????s[a].count?=1?;
a++;}

t++;}

for?(j?=?0;?j
for?(i?=?0;?i
if?(s[i].words?>s[i?+?1].words?)

{

e?=?s[i];
s[i]?=?s[i?+?1];
s[i?+?1]?=e;
}
}
void?sqsave(sqlist?&L)
{int?it=0f=1jpq=1;
L.elem=new?sq[5000];
if(!L.elem)exit(0);
L.length?=0;
while(t{
p=f;
for?(i?=?1;?i {
????????if?(word[t]?==L.elem?[i].words?)//如果有單詞相同
????????{
L.elem?[i].count?++;//則此類單詞加1
????????break;
}
}

????if?(f?==?1?||?i?==?f)/

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????19129??2016-12-30?11:37??實習.cpp
?????文件???????26112??2017-11-13?16:11??實習報告書.doc

評論

共有 條評論