
数据结构
文章平均质量分 75
Yjiokm
记录一些我不熟的东西方便以后来查
展开
-
C语言单向链表
单链表#include #include struct Node{ char ch; Node * next;};struct CharList{ Node * head; Node * tail; Node * prev;};void InitCharList(CharList * list){ list->head = list->tail = list->p原创 2016-07-04 11:11:11 · 413 阅读 · 0 评论 -
链式存储的二叉树的操作思想示意
树的遍历,获取深度#include #define ADT floattypedef struct TNode{ struct TNode * parent;//父结点 struct TNode * lchild;//左子树 struct TNode * rchild;//右子树 ADT value;} * BinTree;void SetTNode(TNode * p原创 2016-07-17 15:16:48 · 354 阅读 · 0 评论 -
最简单逻辑迷宫求解
#include #include #define ROW 6#define COL 6int a[ROW][COL] = { 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1};//1:通路; 0:障碍s原创 2016-08-22 15:34:58 · 517 阅读 · 0 评论 -
由数组创建二叉树,二叉树遍历,获取深度,销毁
先序遍历:A->B->D->E->C中序遍历:D->B->E->A->C后序遍历:D->E->B->C->A#include typedef char ElemType;#define EndElem '^'//用^来表示空typedef struct BiNode{ ElemType elem; struct BiNode * lchild; struct B原创 2016-09-01 11:21:05 · 481 阅读 · 0 评论 -
Prim最小生成树
1. 静态的示意 由N个顶点的无向连通图生成最小生成树的各条边放在容量为N - 1的数组中。#include #include #define N 6//N个顶点struct Edge {int i; int j; int w;};//i: 起点下标 j: 终点下标 w: 权//int (*adjmatrix)[N]: 邻接矩阵行地址//Edge edge[N - 1]: 输原创 2016-09-15 15:22:59 · 205 阅读 · 0 评论 -
栈实现的图邻接矩阵深度优先遍历
#include #define N 6// 深度优先遍历void DFS_Traverse(bool adjmatrix[][N], int v0, void (*f)(int)){ bool visited[N] = {true};// v0设为已访问 int stack[N] = {v0};// 栈添加v0 int size = 1; f(v0); while (size原创 2016-10-09 21:40:15 · 1922 阅读 · 0 评论