随笔分类 -  数据结构

摘要:#include<stdio.h> #include<malloc.h> typedef char ElemType; typedef struct BiTNode { ElemType data; struct BiTNode* lchild, * rchild; }BiTNode,*BiTree 阅读全文
posted @ 2020-07-24 21:59 石乐智先生 阅读(344) 评论(0) 推荐(0)
摘要:/*二叉树前序、中序、层次层次遍历*/ #include<stdio.h> #include<malloc.h> typedef char ElemType; typedef struct BiTNode { ElemType val; struct BiTNode *lchild,*rchild; 阅读全文
posted @ 2020-07-23 20:10 石乐智先生 阅读(228) 评论(0) 推荐(0)
摘要:/*二叉树递归遍历*/ #include<stdio.h> #include<malloc.h> typedef char ElemType; typedef struct BitNode { ElemType data; struct BitNode * lchild,*rchild; }BitN 阅读全文
posted @ 2020-07-16 21:29 石乐智先生 阅读(190) 评论(0) 推荐(0)
摘要:#include<stdio.h> #define MaxSize 255 typedef struct { char ch[MaxSize]; int length; }SString; void InitStr(SString &S) { S.ch[0]=' '; S.length=0; } v 阅读全文
posted @ 2020-07-13 20:29 石乐智先生 阅读(321) 评论(0) 推荐(0)
摘要:#include<stdio.h> #define MaxSize 255 typedef struct { char ch[MaxSize]; int length; }SString; void InitStr(SString &S) { S.ch[0]=' '; S.length=0; } v 阅读全文
posted @ 2020-07-13 20:08 石乐智先生 阅读(402) 评论(0) 推荐(0)
摘要:#include<stdio.h> #define MaxSize 255 typedef struct { char ch[MaxSize]; int length; }SString; void InitStr(SString &S) { S.ch[0]='¥'; S.length=0; } v 阅读全文
posted @ 2020-07-12 21:15 石乐智先生 阅读(781) 评论(0) 推荐(0)
摘要:(一):中缀表达式转后缀表达式从左到右处理各个元素1.遇到操作数。直接加入后缀表达式2.遇到界限符。遇到'('直接入栈,遇到')'则依次弹出栈内运算符并加入后缀表达式,直到弹出'('为止。注意:'('不加入后缀表达式。3.遇到运算符。依次弹出栈中优先级高于或等于当前运算符的所有运算符,并加入后缀表达 阅读全文
posted @ 2020-07-04 21:21 石乐智先生 阅读(780) 评论(0) 推荐(0)
摘要:#include<stdio.h> #define MaxSize 10 typedef char ElemType; typedef struct { ElemType data[MaxSize]; int top; }SList; void InitSList(SList &S) { S.top 阅读全文
posted @ 2020-07-03 22:04 石乐智先生 阅读(318) 评论(0) 推荐(0)
摘要:#include<stdio.h> #include<malloc.h> typedef char ElemType; typedef struct LinkNode { ElemType data; struct LinkNode *next; }LinkNode; typedef struct 阅读全文
posted @ 2020-06-28 21:10 石乐智先生 阅读(687) 评论(0) 推荐(0)
摘要:#include<stdio.h> #include<malloc.h> typedef char ElemType; typedef struct LinkNode { ElemType data; struct LinkNode *next; }LinkNode; typedef struct 阅读全文
posted @ 2020-06-28 10:39 石乐智先生 阅读(450) 评论(0) 推荐(0)
摘要:/*增设表示元素个数的数据*/ #include<stdio.h> #define MaxSize 10 typedef char ElemType; typedef struct { ElemType data[MaxSize]; int front,rear; int size; }SqQueu 阅读全文
posted @ 2020-06-27 19:27 石乐智先生 阅读(289) 评论(0) 推荐(0)
摘要:/*增设tag数据,区分队满队空*/ #include<stdio.h> #define MaxSize 10 typedef char ElemType; typedef struct { ElemType data[MaxSize]; int front,rear,tag; }SqQueue; 阅读全文
posted @ 2020-06-27 18:50 石乐智先生 阅读(334) 评论(0) 推荐(0)
摘要:/*牺牲一个单元来区分队空队满*/#include<stdio.h>#define MaxSize 10typedef char ElemType;typedef struct { ElemType data[MaxSize]; int front,rear;}SqQueue;bool InitQu 阅读全文
posted @ 2020-06-27 17:41 石乐智先生 阅读(323) 评论(0) 推荐(0)
摘要:#include<stdio.h> #define MaxSize 10 typedef char ElemType; typedef struct { ElemType data[MaxSize]; int top; }SqStack; void InitStack(SqStack &s) //初 阅读全文
posted @ 2020-06-26 17:55 石乐智先生 阅读(444) 评论(0) 推荐(0)
摘要:#include<stdio.h> #include<malloc.h> typedef char ElemType; typedef struct DNode { ElemType data; struct DNode *prior; struct DNode *next; }DNode,*DLi 阅读全文
posted @ 2020-06-19 20:01 石乐智先生 阅读(240) 评论(0) 推荐(0)
摘要:/*头插法实现单链表逆置*/ #include<stdio.h> #include<malloc.h> typedef struct LNode { char data; struct LNode *next; }LNode,*LinkList; bool InitList(LinkList &L) 阅读全文
posted @ 2020-06-18 22:22 石乐智先生 阅读(737) 评论(0) 推荐(0)
摘要:/*单链表*/ #include<stdio.h> #include<malloc.h> typedef int ElemType; typedef struct LNode{ ElemType data; struct LNode *next; }LNode,*LinkList; bool Ini 阅读全文
posted @ 2020-06-18 21:25 石乐智先生 阅读(401) 评论(0) 推荐(0)
摘要:#include<stdio.h> #define MaxSize 10 typedef int ElemType; typedef struct{ ElemType data[MaxSize]; ElemType length; }SqList; void InitList(SqList &L) 阅读全文
posted @ 2020-06-17 20:26 石乐智先生 阅读(233) 评论(0) 推荐(0)