随笔分类 -  数据结构

摘要:实现单链表的基本操作(创建,查询,插入,删除,销毁,归并,排序)创建链表 La链表初始化成功请输入La中元素的个数:9请输入第 9 个元素:9请输入第 8 个元素:8请输入第 7 个元素:7请输入第 6 个元素:6请输入第 5 个元素:5请输入第 4 个元素:4请输入第 3 个元素:3请输入第 2 个元素:2请输入第 1 个元素:11 2 3 4 5 6 7 8 9创建链表 Lb链表初始化成功请输入Lb中元素的个数:5请输入第 5 个元素:9请输入第 4 个元素:7请输入第 3 个元素:5请输入第 2 个元素:3请输入第 1 个元素:11 3 5 7 9合并链表 La ... 阅读全文
posted @ 2013-12-11 17:40 若。只如初见 阅读(1544) 评论(17) 推荐(0)
摘要:实现顺序表的静态查找(SeqSearch、BinarySearch、GoldenSectionSearch、)how many elements in your list:20Please enter the 1th number:1Please enter the 2th number:11Please enter the 3th number:2Please enter the 4th number:22Please enter the 5th number:3Please enter the 6th number:33Please enter the 7th number:4Please 阅读全文
posted @ 2013-12-06 22:39 若。只如初见 阅读(481) 评论(2) 推荐(0)
摘要:1 //---------有向图的十字链表表存储表示------- 2 3 #include 4 #include 5 6 #define MAX_VERTEXT_NUM 20 7 8 typedef int InfoType; 9 typedef char VertextType; 10 11 typedef struct ArcBox 12 { 13 int headVex; 14 int tailVex; 15 struct ArcBox *headLink; 16 struct ArcBox *tailLink; 17 ... 阅读全文
posted @ 2013-11-25 13:22 若。只如初见 阅读(3354) 评论(0) 推荐(0)
摘要:1 #define _CRT_SECURE_NO_WARNINGS 2 #include 3 #include 4 #include 5 6 #define MAX_SIZE 255 // 定义字符串的最大长度 7 8 typedef unsigned char SString[MAX_SIZE]; //数组第一个保存长度 9 //BF 10 int BFMatch(char *s,char *p) 11 { 12 int i,j; 13 i=0; 14 while(i < strlen(s)) 15 { 16 ... 阅读全文
posted @ 2013-11-25 12:41 若。只如初见 阅读(286) 评论(0) 推荐(0)
摘要://---------图的邻接表存储表示-------#include#include#define MAX_VERTEXT_NUM 20typedef int InfoType;typedef char VertextType;typedef struct ArcNode{ int adjvex; struct ArcNode *nextArc; InfoType *info;}ArcNode;typedef struct VNode{ VertextType data; ArcNode *firstArc;}VNode, AdjList[MAX_VERTEXT... 阅读全文
posted @ 2013-11-25 12:36 若。只如初见 阅读(566) 评论(0) 推荐(0)
摘要:实现二叉树的创建(先序)、递归及非递归的先、中、后序遍历请按先序遍历输入二叉树元素(每个结点一个字符,空结点为'='):ABD==E==CF==G==先序递归遍历:A B D E C F G中序递归遍历:D B E A F C G后序递归遍历:D E B F G C A层序递归遍历:ABCDEFG先序非递归遍历:A B D E C F G中序非递归遍历:D B E A F C G后序非递归遍历:D E B F G C A深度:3请按任意键继续. . . 1 #include 2 #include 3 4 #define OK 1 5 #define ERROR 0 6 #def 阅读全文
posted @ 2013-11-24 23:15 若。只如初见 阅读(951) 评论(0) 推荐(0)
摘要:在顺序存储结构实现基本操作:初始化、创建、插入、删除、查找、遍历、逆置、合并运算。运行示例:请输入线性表La的长度:5请输入线性表La中的元素(共5个)1 3 5 7 9*** 此时线性表La中的元素 ***1 3 5 7 9*** 插入数据 ***请输入要插入的位置:3请输入要插入的元素:8888*** 此时线性表La中的元素 ***1 3 8888 5 7 9*** 删除数据 ***请输入要删除元素的位置:2*** 此时线性表La中的元素 ***1 8888 ... 阅读全文
posted @ 2013-10-22 13:45 若。只如初见 阅读(3489) 评论(3) 推荐(0)