![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数据结构与算法
lynchyo
这个作者很懒,什么都没留下…
展开
-
普通查找与二分法
普通查找:int find(int array[], int length, int data) { if(NULL == array || 0 == length) return -1; for(int i = 0; i < length; i++){ if(data == array[i])原创 2014-03-10 21:36:30 · 457 阅读 · 0 评论 -
线性表链式存储
#include#include#include typedef int ElemType;typedef int Status;#define ERROR 0#define OK 1Status visit(ElemType e){ printf("%d ",e); return OK;}typedef struct Node{ ElemType data;原创 2014-09-17 21:51:32 · 427 阅读 · 0 评论 -
二叉树链式结构实现
#include "string.h"#include "stdio.h" #include "stdlib.h" #include "io.h" #include "math.h" #include "time.h"#define OK 1#define ERROR 0#define TRUE 1#define FALSE 0#define MAXSIZE原创 2014-09-22 15:35:19 · 489 阅读 · 0 评论 -
二叉树顺序结构实现
#include "stdio.h" #include "stdlib.h" #include "io.h" #include "math.h" #include "time.h"#define OK 1#define ERROR 0#define TRUE 1#define FALSE 0#define MAXSIZE 100 /* 存储空间初始分配量 */原创 2014-09-22 10:49:54 · 702 阅读 · 0 评论 -
朴素模式匹配和KMP
#include#include#include#define OK 1#define ERROR 0#define TRUE 1#define FALSE 0#define MAXSIZE 100typedef int Status;typedef int ElemType;typedef char String[MAXSIZE+1];/* 生成一个其值等于p的串T原创 2014-09-22 08:50:10 · 499 阅读 · 0 评论 -
静态链表
#include "string.h"#include "ctype.h" #include "stdio.h" #include "stdlib.h" #include "io.h" #include "math.h" #include "time.h"#define OK 1#define ERROR 0#define TRU原创 2014-09-18 11:29:13 · 416 阅读 · 0 评论 -
顺序队列
#include#include#define MAXSIZE 20#define OK 1#define ERROR 0#define TRUE 1#define FALSE 0typedef int Status;typedef int QElemType;typedef struct SqQueue{ QElemType data[MA原创 2014-09-19 10:21:24 · 472 阅读 · 0 评论 -
链栈
#include#includetypedef int ElemType;typedef int Status;#define OK 1#define ERROR 0#define TRUE 1#define FALSE 0typedef struct StackNode{ ElemType data; struct StackNode *next;}StackNod原创 2014-09-18 21:43:03 · 639 阅读 · 0 评论 -
链队列
#include#include#include#define OK 1#define ERROR 0#define TRUE 1#define FALSE 0typedef int QElemType;typedef int Status;typedef struct QNode{ QElemType data; struct QNod原创 2014-09-19 11:17:22 · 426 阅读 · 0 评论 -
两栈共享空间
#include "stdio.h" #include "stdlib.h" #include "io.h" #include "math.h" #include "time.h"#define OK 1#define ERROR 0#define TRUE 1#define FALSE 0#define MAXSIZE 20 /* 存储空间初始分配量 */t原创 2014-09-18 20:15:17 · 416 阅读 · 0 评论 -
顺序栈
#include#includetypedef int Status; typedef int ElemType;#define MaxSize 20#define OK 1#define ERROR 0#define FALSE 0#define TRUE 1typedef struct SqStack{ ElemType data[MaxSi原创 2014-09-18 17:20:24 · 498 阅读 · 0 评论 -
八大排序算法
概述排序有内部排序和外部排序,内部排序是数据记录在内存中进行排序,而外部排序是因排序的数据很大,一次不能容纳全部的排序记录,在排序过程中需要访问外存。 我们这里说说八大排序就是内部排序。 当n较大,则应采用时间复杂度为O(nlog2n)的排序方法:快速排序、堆排序或归并排序序。快速排序:是目前基于比较的内部排序中被认为是最好的方法,当待排序的关键字是随机分布时,快速转载 2014-07-31 09:41:05 · 375 阅读 · 0 评论 -
线性表顺序存储
#include #include typedef int ElemType;typedef int Status;#define ERROR 0typedef struct{ int data[20]; int length;}SqList;/* 初始化顺序线性表 */int InitList(SqList *q){ q->length=0; return 1;}原创 2014-09-17 21:49:19 · 428 阅读 · 0 评论