随笔分类 - 数据结构
摘要:#include<stdio.h> #include<malloc.h> typedef char ElemType; typedef struct BiTNode { ElemType data; struct BiTNode* lchild, * rchild; }BiTNode,*BiTree
阅读全文
摘要:/*二叉树前序、中序、层次层次遍历*/ #include<stdio.h> #include<malloc.h> typedef char ElemType; typedef struct BiTNode { ElemType val; struct BiTNode *lchild,*rchild;
阅读全文
摘要:/*二叉树递归遍历*/ #include<stdio.h> #include<malloc.h> typedef char ElemType; typedef struct BitNode { ElemType data; struct BitNode * lchild,*rchild; }BitN
阅读全文
摘要:#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
阅读全文
摘要:#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
阅读全文
摘要:#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
阅读全文
摘要:(一):中缀表达式转后缀表达式从左到右处理各个元素1.遇到操作数。直接加入后缀表达式2.遇到界限符。遇到'('直接入栈,遇到')'则依次弹出栈内运算符并加入后缀表达式,直到弹出'('为止。注意:'('不加入后缀表达式。3.遇到运算符。依次弹出栈中优先级高于或等于当前运算符的所有运算符,并加入后缀表达
阅读全文
摘要:#include<stdio.h> #define MaxSize 10 typedef char ElemType; typedef struct { ElemType data[MaxSize]; int top; }SList; void InitSList(SList &S) { S.top
阅读全文
摘要:#include<stdio.h> #include<malloc.h> typedef char ElemType; typedef struct LinkNode { ElemType data; struct LinkNode *next; }LinkNode; typedef struct
阅读全文
摘要:#include<stdio.h> #include<malloc.h> typedef char ElemType; typedef struct LinkNode { ElemType data; struct LinkNode *next; }LinkNode; typedef struct
阅读全文
摘要:/*增设表示元素个数的数据*/ #include<stdio.h> #define MaxSize 10 typedef char ElemType; typedef struct { ElemType data[MaxSize]; int front,rear; int size; }SqQueu
阅读全文
摘要:/*增设tag数据,区分队满队空*/ #include<stdio.h> #define MaxSize 10 typedef char ElemType; typedef struct { ElemType data[MaxSize]; int front,rear,tag; }SqQueue;
阅读全文
摘要:/*牺牲一个单元来区分队空队满*/#include<stdio.h>#define MaxSize 10typedef char ElemType;typedef struct { ElemType data[MaxSize]; int front,rear;}SqQueue;bool InitQu
阅读全文
摘要:#include<stdio.h> #define MaxSize 10 typedef char ElemType; typedef struct { ElemType data[MaxSize]; int top; }SqStack; void InitStack(SqStack &s) //初
阅读全文
摘要:#include<stdio.h> #include<malloc.h> typedef char ElemType; typedef struct DNode { ElemType data; struct DNode *prior; struct DNode *next; }DNode,*DLi
阅读全文
摘要:/*头插法实现单链表逆置*/ #include<stdio.h> #include<malloc.h> typedef struct LNode { char data; struct LNode *next; }LNode,*LinkList; bool InitList(LinkList &L)
阅读全文
摘要:/*单链表*/ #include<stdio.h> #include<malloc.h> typedef int ElemType; typedef struct LNode{ ElemType data; struct LNode *next; }LNode,*LinkList; bool Ini
阅读全文
摘要:#include<stdio.h> #define MaxSize 10 typedef int ElemType; typedef struct{ ElemType data[MaxSize]; ElemType length; }SqList; void InitList(SqList &L)
阅读全文

浙公网安备 33010602011771号