第八周 專案5 模式匹配

2021-07-06 02:36:41 字數 1480 閱讀 3640

煙台大學計算機與控制工程學院      

檔名稱:第8周專案5--模式匹配 kmp演算法

作 者:呂云雙

完成日期:2023年10月23日

問題描述:使用佇列陣列

版 本 號:v1.0

//原始檔

#define maxsize 100 //最多的字元個數

typedef struct

sqstring;

void strassign(sqstring &s,char cstr); //字串常量cstr賦給串s

void strcopy(sqstring &s,sqstring t); //串t複製給串s

bool strequal(sqstring s,sqstring t); //判串相等

int strlength(sqstring s); //求串長

sqstring concat(sqstring s,sqstring t); //串連線

sqstring substr(sqstring s,int i,int j); //求子串

sqstring insstr(sqstring s1,int i,sqstring s2); //串插入

sqstring delstr(sqstring s,int i,int j) ; //串刪去

sqstring repstr(sqstring s,int i,int j,sqstring t); //串替換

void dispstr(sqstring s); //輸出串

//原始檔

#include #include #include "sqstring.h"

void strassign(sqstring &s,char cstr) //s為引用型引數

void strcopy(sqstring &s,sqstring t) //s為引用型引數

}return(count);

}int main()

執行結果:

下面簡述bf演算法與kmp演算法:

第八周 專案5計數的模式匹配

all right reserved.檔名稱 project5.cpp 作 者 商文軻 完成日期 2015年10月20日 版 本 號 v1.9 問題描述 採用順序結構儲存串,編寫乙個演算法計算指定子串在乙個字串中出現的次數,如果該子串不出現則為0 程式採用多組織結構,用到順序串演算法庫sqstrin...

第八周 專案5 計數的模式匹配

檔名稱 main.cpp 作者 王超 完成日期 2015年10月23日 問題描述 計數的模式匹配 include include sqstring.h int main include include include sqstring.h int str count sqstring s,sqstr...

第八周專案5計數的匹配模式

問題及描述 輸入描述 sqstring.h ifndef sqstring h included define sqstring h included define maxsize 100 最多的字元個數 typedef struct sqstring void strassign sqstring...