目录
串的定义(前置条件):
顺序串:(一般常用)
//基于线性表的定义所做的更改
#include<iostream>
using namespace std;
#include<stdlib.h>//存放exit
#include<math.h>//OVERFLOW,exit
typedef int Status;
#define MAXLEN 255
struct SString
//Sequence String
{
char ch[MAXLEN + 1]; //存储串的一维数组
int length; //串的当前长度长度
};
链串:
//链串的定义及其基础操作
#include<iostream>
using namespace std;
#include<stdlib.h>//存放exit
#define CHUNKSIZE 80//块的大小可由用户定义
typedef int Status; //函数调用状态
struct Chunk
//厚块; 厚片; 大块; 组块;
{
char ch[CHUNKSIZE];
Chunk* next;
};
struct LString
{
Chunk* head, * tail;
int curlen;//current length:当前长度
};
int main()
{
}

本文介绍了串的两种表示方式——顺序串和链串,并提供了它们的基本操作如赋值、比较、求长度等的实现。接着,文章详细讲解了BF(BruteForce)算法和KMP算法在字符串匹配中的应用,包括算法原理和C++代码实现。
最低0.47元/天 解锁文章
933

被折叠的 条评论
为什么被折叠?



