文章分类 - 数据结构与算法
摘要:BF 匹配算法: #include <stdio.h> #include <string.h> #define MAXSIZE 100 // 返回匹配成功的字符在主串中的索引 // 如果匹配失败,则返回-1 // 索引从0开始 int BF(char* s, char* t, int slen, i
阅读全文
摘要:定义一个栈 顺序栈的存储结构: #define MAXSIZE 20 typedef int ElemType; typedef struct { ElemType data[MAXSIZE]; int top; }SqStack; 通常更简单的做法是在主函数中直接定义一个数组用作栈,并定义一个整数
阅读全文
摘要:顺序表 顺序表的存储结构 // 顺序表的存储结构 #define MAXSIZE 20 // 元素个数的最大值 typedef int ElemType; // ElemType 根据实际情况而定,这里假定为 int typedef struct { ElemType data[MAXSIZE];
阅读全文