数据结构
拂袖秋波
这个作者很懒,什么都没留下…
展开
-
邻接矩阵实现深度优先搜索,广度优先搜索
#include<stdio.h>const int N=20;#define TRUE 1#define FALSE 0int visited[N];typedef struct /*队列的定义*/{ int data[N]; int front,rear;} queue;typedef struct /*图的邻接矩阵*/{ int vexnu原创 2017-11-30 15:14:08 · 1140 阅读 · 0 评论 -
折半查找和顺序查找
折半查找(二分):#include <stdio.h>#include <stdlib.h>#define MAX_NUM 100typedef struct{ int key;} ElemType;typedef struct{ ElemType elem[MAX_NUM]; int length;} SSTable;int s(SSTable st,in原创 2017-12-19 20:23:06 · 350 阅读 · 0 评论 -
邻接表存储的拓扑排序
邻接表存储的拓扑排序原创 2017-11-30 15:06:10 · 1554 阅读 · 0 评论 -
快速排序
从待排序区间中任取一个记录(通常是第一个)作为枢纽记录(即基准记录),所有比基准记录小的记录一律放在其左侧,所有比基准记录大的记录一律放在右侧,形成两个子表;枢纽记录放在两个子表中间的位置(也是枢纽记录最终的位置)。然后对两个子表重新选择枢纽记录,重复上述操作。#include <stdio.h>#define N 200int a[N];int quick(int i,int j){原创 2017-12-12 14:53:56 · 176 阅读 · 0 评论 -
课程设计——路经查询相关代码
#include #include #include #include #include using namespace std;const int inf=0x3f3f3f3f;const int N=8;int mapp[N][N]; //存放校园路径长度int path[N][N]; //存放校园路径长度的临时数组int short0[N][N];原创 2018-01-21 19:16:37 · 169 阅读 · 0 评论