随笔分类 -  数据结构与算法

摘要:1 // graph.cpp : 定义控制台应用程序的入口点。 2 //邻接矩阵表示 3 #include "stdafx.h" 4 #include 5 #define INFINITY 32767 6 #define MAX_VEX 20 7 #define QUEUE_SIZE 20 8 bool *visited; //用来判断是否遍历过,为true则遍历过,为false,则未遍历过 9 10 typedef struct{ 11 cha... 阅读全文
posted @ 2014-03-16 16:54 风华一指流砂,苍老一段年华 阅读(352) 评论(0) 推荐(0)
摘要:各种基本算法实现小结(三)—— 树与二叉树(均已测试通过)===================================================================二叉树——先序测试环境:VS 2010 1 #include 2 #include 3 #include 4 struct _node 5 { 6 char data; 7 struct _node *lchild; 8 struct _node *rchild; 9 };... 阅读全文
posted @ 2014-03-08 18:20 风华一指流砂,苍老一段年华 阅读(343) 评论(0) 推荐(0)
摘要:各种基本算法实现小结(二)—— 堆 栈(均已测试通过)==============================================================栈——数组实现测试环境:VS 2010 1 #include 2 char stack[512]; 3 int top=0; 4 void push(char c) 5 { 6 stack[top]=c; 7 top++; 8 } 9 char pop() 10 { 11 ... 阅读全文
posted @ 2014-03-07 19:16 风华一指流砂,苍老一段年华 阅读(265) 评论(0) 推荐(0)
摘要:各种基本算法实现小结(一)—— 单链表(均已测试通过)单链表(测试通过) 测试环境:VS 2010 1 #include 2 struct _node 3 { 4 int data; 5 struct _node *next; 6 }; 7 typedef struct _node list; 8 void display(list *l) 9 { 10 list *p; 11 p=l; 12 while(p->next... 阅读全文
posted @ 2014-03-07 11:37 风华一指流砂,苍老一段年华 阅读(210) 评论(0) 推荐(0)