摘要:
稀疏矩阵使用三元组顺序表存储表示:#include using namespace std;#define MAXSIZE 12500typedef struct { int i, j; int e;}Triple;typedef struct { Triple data[MAXSIZE + 1]; int rpos[MAXSIZE + 1]; int mu, nu, tu;}TSMatrix;int FastTransposeSMatrix(TSMatrix M, TSMatrix &T);int main(){ TSMatrix M, T; int... 阅读全文
摘要:
子串的定位操作通常称为串的模式匹配。以下算法中:S—主串,T—子串(模式串)字符数组存储从下标 1 开始,String[0] 记录字符数组长度。#include #include #include using namespace std;#define MAXSTRLEN 255typedef unsigned char SString[MAXSTRLEN + 1];int Index(SString S, SString T, int pos); //普通匹配算法int Index_KMP(SString S, SString T, int pos);void get_next(SSt... 阅读全文