摘要: 稀疏矩阵使用三元组顺序表存储表示:#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... 阅读全文
posted @ 2014-03-17 22:15 夜尽·天明 阅读(347) 评论(0) 推荐(0) 编辑
摘要: 子串的定位操作通常称为串的模式匹配。以下算法中: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... 阅读全文
posted @ 2014-03-17 20:24 夜尽·天明 阅读(200) 评论(0) 推荐(0) 编辑