![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数据结构基础
lie隼
这个作者很懒,什么都没留下…
展开
-
队列的顺序存储及其基本操作
#include #include #define QueueSize 10typedef struct{ char data [QueueSize]; int front,rear;}SqQueue;void InitQueue(SqQueue &qu) //初始化队列{ qu.rear=qu.front=0;}int EnQueue(SqQue原创 2013-08-15 09:57:55 · 782 阅读 · 0 评论 -
约瑟夫环问题之选猴王
n只猴子围成一圈,顺时针方向从1到n编号。之后从1号开始沿着顺时针方向让猴子从1,2,3……,m依次报数,凡报到m的猴子都让其出圈,取消候选资格。然后不停的俺顺时针方向报数,让报到m的猴子出圈,最后剩下一个就是猴王。#include #include struct mon{ int num; struct mon * next;};struct mon * cre原创 2015-10-28 21:38:41 · 2428 阅读 · 0 评论 -
快速排序以及二分查找的实现
#include int BinSearch(int a[],int left,int right,int key);//声明二分查找void QuickSort(int a[],int left,int right);//声明快速排序int main(){ int a[101]; int i,n,key; printf("Please input total原创 2015-10-28 10:57:23 · 861 阅读 · 0 评论 -
链表的逆置,归并,拆分以及其他函数集合
#include #include struct node{ int data; struct node *next;};struct node * creat1(int n)//逆序建立链表{ struct node *head,*p; int i; head=(struct node *)malloc(sizeof(struct node)原创 2013-08-10 11:07:56 · 747 阅读 · 0 评论 -
顺序队列的基本操作
#include #include //#include #define MAXSIZE 100#define OK 1#define TRUE 1#define FALSE 0#define ERROR 0//using namespace std;typedef struct{ int data[MAXSIZE]; int front; //原创 2014-02-11 21:56:04 · 1011 阅读 · 0 评论 -
基于顺序栈的进制转换
#include #include #define M 10typedef struct //定义一个顺序栈{ int data[M]; int top;}SqStack;void InitStack(SqStack &st)//创建一个栈{ st.top=-1;}int PushStack(SqStack &st,原创 2013-10-09 09:36:12 · 1048 阅读 · 0 评论 -
栈的顺序存储及其基本操作
#include #include #define M 10typedef struct //定义一个顺序栈{ char data[M]; int top;}SqStack;void InitStack(SqStack &st)//创建一个栈{ st.top=-1;}int PushStack(SqStack &st, char x)//进栈操作原创 2013-08-14 11:13:21 · 1648 阅读 · 0 评论 -
队列的链式存储及其基本运算
#include #include #define QueueSize 10typedef struct Qnode //链队列的定义{ char data; struct Qnode *next;}Qtype; //链队中节点类型typedef struct qptr{ Qtype *front,*rear; //链队原创 2013-08-15 15:42:14 · 626 阅读 · 0 评论 -
栈的链式存储及其基本运算
#include #include #define M 10typedef struct stnode{ char data; struct stnode *next;}LinkStack;void InitStack(LinkStack *&ls) //初始化栈{ ls=NULL;}void PushStack(LinkStack *&ls,ch原创 2013-08-14 10:56:37 · 491 阅读 · 0 评论 -
简单二叉树的建立和遍历
C语言建立先序二叉树,然后分别用先序,中序,后序遍历输出该二叉树。转载 2017-03-13 13:47:38 · 7100 阅读 · 8 评论