- 博客(6)
- 收藏
- 关注
原创 二叉搜索树代码
#include #include #include #define NULL 0 typedef struct node { int data; struct node * lchild; struct node * rchild; }Btree; Btree*CreateBtree(int a[], int n) { int i;
2016-05-08 10:39:48
154
原创 队列程序
队列代码 在已知总长度的情况下,用循环队列(顺序存储);在总长度未知的情况下,用链队列(链式存储) A 链式存储 #include #include typedef structstudent { int data; structstudent*next; }node; typedef structlinkqueue { node*first; node*rear;
2016-04-27 11:03:25
314
原创 栈代码
1. 栈以顺序存储方式实现 (1)入栈:栈满 top==Maxsize-1 (2)出栈: 栈空top==-1; #include #include #include typedef struct stock { int Maxsize; int top; int *ps; }Stock; // 初始化栈 void InitStock(sto
2016-04-26 11:10:21
232
原创 约瑟夫环问题(循环链表)
题目:已知共有n个人,从编号为k的人开始报数,数到m的那个人出列,然后从下一个开始报数,数到m出列……直到所有人都出列。 #include #include typedef struct node { int data; struct node *next; }ElemSN; ElemSN*Creatlink(int n) { int i;
2016-04-21 21:58:21
317
原创 双链表程序
#include #include #include #define NULL 0 typedef struct node { int data; struct node*prio; struct node*next; }ElemSN; //创建双向链表 ElemSN*Creatlink(int a[],int n) { Ele
2016-04-21 13:32:18
169
原创 单链表程序
#include #include #define NULL 0 typedef struct node { intdata; structnode * next; }ElemSN; //删除结点 ElemSN*DelNode(ElemSN *h, int x) { ElemSN*p; ElemSN *q;
2016-04-20 20:36:38
371
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人