数据结构
文章平均质量分 80
sense_long_h
这个作者很懒,什么都没留下…
展开
-
数据结构——线性表以及各功能的实现
#include#include"SeqList.h"using namespace std;void main(){ SeqList mylist; InitSeqList(&mylist); int select = 1; ElemType item; int pos; while(select) { cout<<"*****************原创 2015-04-24 00:26:40 · 549 阅读 · 0 评论 -
数据结构 -----双链表的创建及其各功能的实现
#include"DCList.h"void InitList(List *list){ Node *s = (Node *)malloc(sizeof(Node)); assert(s != NULL); list->first = list->last = s; list->first->prev = list->last; list->last->next = list->f原创 2015-05-09 00:52:55 · 399 阅读 · 0 评论 -
数据结构--利用栈判断括号匹配
/*下午打球去了,虐菜了*/ #ifndef _MATCH_H_#define _MATCH_H_ #include #include #include using namespace std; typedef char ElemType; #define STACK_INIT_SIZE 50 typedef struct Stack {原创 2015-05-16 00:53:28 · 972 阅读 · 0 评论 -
数据结构-----顺序栈的实现
#ifndef _SEQSTACK_H#define _SEQSTACK_H#include#includeusing namespace std;typedef int ElemType;#define STACK_INIT_SIZE 8typedef struct Stack{ ElemType *base; int top; int ca原创 2015-05-10 00:27:00 · 1418 阅读 · 0 评论 -
串及其功能的实现
#ifndef _STRING_H_#endif _STRING_H_//#pragma once#includeusing namespace std;#define MAX_STRING_SIZE 8typedef char SString[MAX_STRING_SIZE+1]; int Length(SString s){ return strlen(s原创 2015-06-04 23:42:13 · 688 阅读 · 0 评论 -
改进版快速排序(平均复杂度O(NlogN))
#includeusing namespace std;#define MAXSIZE 21typedef int SqList[MAXSIZE]; #define ElementType intvoid Swap(int &a, int &b) { a = a^b; b = a^b; a = a^b; } //*********原创 2015-06-27 17:41:13 · 1341 阅读 · 0 评论 -
KMP算法(详细求串的next[n])
怎么求串的模式值next[n] (1)next[0]= -1 意义:任何串的第一个字符的模式值规定为-1。(2)next[j]= -1 意义:模式串T中下标为j的字符,如果与首字符相同,且j的前面的1—k个字符与开头的1—k个字符不等(或者相等但T[k]==T[j])(1≤k)。如:T=”abCabCad” 则 next[6]=-1,因T[3]=T[6]原创 2015-06-28 20:09:32 · 1280 阅读 · 0 评论