- 博客(62)
- 资源 (3)
- 收藏
- 关注
原创 树和二叉树的应用举例(相似二叉树,由先序和中序、中序和后序确定二叉树)
头文件:函数的声明#include #include #include #include #define MAXSIZE 100typedef char ElemType;typedef struct Node{ ElemType data; struct Node *lchild; struct Node *rchild;}BitNode,*BitTree;int
2015-02-25 22:30:48 608
原创 哈夫曼树
哈夫曼树的定义#include #include #include #define MY_STRMAX 100#define infinity 1000000typedef struct { unsigned int weight; //深度 char ch; //结点数值 unsigned int pa
2015-02-25 02:13:18 475
原创 树、森林与二叉树(树的存储结构(树的孩子兄弟链表应用举例),树转换为二叉树,二叉树转换成树和森林,树和森林的遍历)
树的存储结构/*树的存储结构*//*双亲表示法*/#define MAXSIZE 200typedef char ElemType;typedef struct PNode//双亲表示法的结点定义{ ElemType data; int parent;//指示结点的双亲}PNode;typedef struct//双亲表示法的类型定义{ PNode node[MAXSI
2015-02-25 01:25:53 3594
原创 二叉树的线索化
头文件:函数的声明#include #include #include #define MAXSIZE 100typedef char ElemType;typedef enum{ Link,/*指向孩子结点*/Thread/*指向前驱或后继*/} PointerTag;typedef struct Node{ ElemType data; struct Node *l
2015-02-25 00:44:24 637
原创 二叉树的计数
头文件:函数的声明#include #include #include #define MAXSIZE 100typedef char ElemType;typedef struct Node{ ElemType data; struct Node *lchild; struct Node *rchild;}*BitTree,BitNode;void CreateBit
2015-02-24 13:17:12 604
原创 二叉树的输出
头文件:函数的声明#include #include #include #define MAXSIZE 100typedef char ElemType;typedef struct Node{ ElemType data; struct Node *lchild; struct Node *rchild;}*BitTree,BitNode;void CreateBit
2015-02-24 12:07:58 1167
原创 二叉树遍历实例
头文件:函数的声明#include #include #include #define MAXSIZE 100typedef char ElemType;typedef struct Node{ ElemType data; struct Node *lchild; struct Node *rchild;}*BitTree,BitNode;/*二叉树的基本操作*/vo
2015-02-24 04:19:49 634
原创 二叉树的链式存储
头文件:函数的声明#include #include #include #define MAXSIZE 100typedef char ElemType;typedef struct Node{ ElemType data; struct Node *lchild; struct Node *rchild;}*BitTree,BitNode;/*二叉树的基本操作*/vo
2015-02-24 04:17:10 658
原创 编写程序比较Brute-Force算法与KMP算法的效果
头文件:函数的声明#include #include #include #define MAXSIZE 60typedef struct{ char str[MAXSIZE]; int length;}SeqString;int B_FIndex(SeqString S,int pos,SeqString T,int *count);int KMP_Index(Se
2015-02-20 23:43:32 874
原创 串的模式匹配
串的结点结构体定义#include #include #include #define MAXSIZE 60typedef struct{ char ch[MAXSIZE]; int length;}SeqString;经典的模式匹配算法Brute-Force#include "串.h"/*经典的模式匹配算法Brute-Force*//*假设串采用顺序存储方
2015-02-18 00:34:19 497
原创 测试链串的基本操作
头文件:函数的声明#include #include #include #define CHUNKSIZE 10#define stuff '#'typedef struct Chunk{ char ch[CHUNKSIZE]; struct Chunk *next;}Chunk;//串的结点类型定义typedef struct{ Chunk *head; Chunk
2015-02-17 00:38:45 819
原创 串的链式存储表示与实现
头文件:函数的声明#include #include #include #define CHUNKSIZE 10#define stuff '#'typedef struct Chunk{ char ch[CHUNKSIZE]; struct Chunk *next;}Chunk;//串的结点类型定义typedef struct{ Chunk *head; Chunk
2015-02-16 22:57:02 1513 1
原创 通过实例测试串的基本操作,如 串的赋值、串的插入、串的删除、串的替换、串的销毁。
头文件:函数的声明#include #include #include typedef struct{ char *str; int length;}HeapString;void InitString(HeapString *S);//串的初始化操作void StrAssign(HeapString *S,char cstr[]);//串的赋值操作int StrEmp
2015-02-14 14:11:57 3420
原创 串的堆分配表示与实现
头文件:函数的声明#include #include #include typedef struct{ char *str; int length;}HeapString;void InitString(HeapString *S);//串的初始化操作void StrAssign(HeapString *S,char cstr[]);//串的赋值操作int StrEmp
2015-02-14 13:25:18 783
原创 假设串S1 = "I come from Beijing",S2 = "Chongqing" ,Sub = "America". 利用串的基本操作,如果串的赋值、串的插入、串的删除、串的替换、对上面
头文件:函数的声明#include #include #define MAXSIZE 60typedef struct{ char str[MAXSIZE]; int length;}SeqString;void StrAssign(SeqString *S,char cstr[]);//串的赋值操作int StrEmpty(SeqString S);//判断串是否为空
2015-02-14 01:25:43 1254
原创 串的顺序存储结构
头文件:函数的声明#include #include #define MAXSIZE 60typedef struct{ char str[MAXSIZE]; int length;}SeqString;void StrAssign(SeqString *S,char cstr[]);//串的赋值操作int StrEmpty(SeqString S);//判断串是否为空
2015-02-14 00:37:14 670
原创 利用顺序存储结构实现双端队列的入队和出队操作
头文件:函数的声明#include #define QUEUESIZE 8typedef char ElemType;typedef struct DQueue{ ElemType queue[QUEUESIZE]; int end1; int end2;}DQueue;int EnQueue(DQueue *DQ,ElemType e,int tag);int DeQu
2015-02-11 19:30:39 4522
原创 编写判断一个字符序列是否为回文。回文是指一个字符序列以中间 字符为基准两边字符完全相同,即顺着看和倒着看是相同的字符序列。
头文件:函数的声明#include #include #include #include typedef char ElemType;//链式堆栈结点类型定义typedef struct snode{ ElemType data; struct snode *next;}LSNode;//只有队尾指针的链式循环队列类型定义typedef struct QNode{
2015-02-11 17:34:00 4969 1
原创 链式队列的表示和实现
头文件:函数的声明#include #include #include #include typedef char ElemType;typedef struct QNode{ ElemType data; struct QNode *next;}LQNode,*QueuePtr;typedef struct{ QueuePtr front; QueuePtr rea
2015-02-11 16:24:43 578
原创 要求顺序循环队不损失一个空间,全部能够得到有效利用,试采用设置标志位tag的方法解决“假溢出”问题,实现顺序循环队列算法
头文件:函数的声明#include #include #define QUEUESIZE 100typedef char ElemType;typedef struct{ ElemType queue[QUEUESIZE]; int front; int rear; int tag;//标志位(入队列成功tag = 1,出队列成功tag = 0)}SCQueue;v
2015-02-10 21:35:04 9922 1
原创 顺序循环队列的表示和实现(少用一个存储空间)
头文件:函数的声明#include #include #define QUEUESIZE 100typedef char ElemType;typedef struct{ ElemType queue[QUEUESIZE]; int front; int rear;}SeqQueue;void InitQueue(SeqQueue *SCQ);int QueueEmp
2015-02-10 20:53:15 4363
原创 编程实现顺序队列的入队操作和出队操作,并将出队结果输出
头文件:函数的声明#include #include #include #define QUEUESIZE 100typedef char ElemType;typedef struct{ ElemType queue[QUEUESIZE]; int front; int rear;}SeqQueue;void InitQueue(SeqQueue *SQ);int
2015-02-10 20:35:42 7176 1
原创 队列的顺序存储和实现
头文件:函数的声明#include #include #include #define QUEUESIZE 100typedef char ElemType;typedef struct{ ElemType queue[QUEUESIZE]; int front; int rear;}SeqQueue;void InitQueue(SeqQueue *SQ);int
2015-02-10 20:32:59 495
原创 利用栈将中缀表达式转换成后缀表达式,并将得到的后缀表达式求值
头文件:函数的声明#include #include #include #define STACKSIZE 100#define MAXSIZE 50typedef char ElemType;typedef struct{ ElemType stack[STACKSIZE]; int top;}SeqStack;typedef struct{ float dat
2015-02-10 00:00:13 4740 2
原创 试利用栈的基本操作编写一个行编辑程序,当前一个字符有误时,输入#消除,当前面一行有误时,输入@消除前面行的字符序列
头文件:函数的声明#include #include #include #define STACKSIZE 100typedef char ElemType;typedef struct{ ElemType stack[STACKSIZE]; int top;}SeqStack;void InitStack(SeqStack *S);//初始化栈int StackE
2015-02-09 16:57:19 901
原创 假设一个数学算法中包括圆括号(),方括号[],花括号{}三种类型,编写表达式的括号是否配对
头文件:函数的声明#include #include #include #include typedef char ElemType;typedef struct node{ ElemType data; struct node *next;}LStackNode,*LinkStack;void InitStack(LinkStack *top);//将链栈初始化int
2015-02-09 16:35:48 23558 2
原创 将十进制转换成八进制
采用链表的形式:头文件:函数的定义#include #include #include #include typedef char ElemType;typedef struct node{ ElemType data; struct node *next;}LStackNode,*LinkStack;void Conversion(int N);函数的声明#
2015-02-08 11:33:42 1339
原创 利用链栈的基本运算,通过输入将字符进栈,然后输出其出栈序列
头文件:函数的定义#include #include #include #include typedef char ElemType;typedef struct node{ ElemType data; struct node *next;}LStackNode,*LinkStack;void InitStack(LinkStack *top);//将链栈初始化int
2015-02-07 20:30:42 4929
原创 设有两个栈S1和S2都采用顺序栈的方式存储,并且共享一个存储区
头文件:函数的定义#include #include #include #define STACKSIZE 100typedef int ElemType;typedef struct{ ElemType stack[STACKSIZE]; int top[2];}SSeqStack;void InitStack(SSeqStack *S);//初始换栈int Stac
2015-02-07 19:44:44 13969
原创 共享栈问题
头文件:函数的定义#include #include #include #define STACKSIZE 100typedef int ElemType;typedef struct{ ElemType stack[STACKSIZE]; int top[2];}SSeqStack;void InitStack(SSeqStack *S);//初始换栈int Stac
2015-02-07 19:22:56 748
原创 将元素a,b,c,d,e依次入栈,然后将d和e出栈,再将f和g进栈,最后将元素全部进栈,并将元素按照出栈次序输出
头文件:函数的声明#include #include #include #define STACKSIZE 100typedef int ElemType;typedef struct{ ElemType stack[STACKSIZE]; int top;}SeqStack;void InitStack(SeqStack *S);//初始化栈int StackEm
2015-02-07 18:50:01 6408
原创 栈的顺序存储结构
头文件:函数的声明#include #include #include #define STACKSIZE 100typedef int ElemType;typedef struct{ ElemType stack[STACKSIZE]; int top;}SeqStack;void InitStack(SeqStack *S);//初始化栈int StackEm
2015-02-07 18:48:20 1569
原创 一元多项式的表示及加减乘法运算
头文件:结点结构用C语言描述如下:#include #include #include typedef struct polyn{ float coef; int expn; struct polyn* next;}PolyNode,*PLinkList;函数声明如下:PLinkList CreatePolyn();//创建一元多项式,使一元多项式呈指数递减v
2015-02-06 19:10:31 1563
原创 创建一个静态链表,通过输入元素及位置插入一个元素,然后通过输入删除元素的位置删除元素。
头文件:函数的声明#include #include #include #define LISTSIZE 100typedef char ElemType;typedef struct{ ElemType data;//数据域 int cur;//指针域,指向直接后继元素}SListNode;//结点空间typedef struct{ SListNode list[LI
2015-02-05 18:45:18 838
原创 编写算法实现建立一个带头结点的含n个元素的双向循环链表H,并在链表H中的第i个位置插入一个元素e
头文件:函数的声明#include #include #include typedef char ElemType;typedef struct Node{ ElemType data; struct Node* prior; struct Node* next;}DListNode,*DLinkList;int InitDList(DLinkList *head);
2015-02-05 00:54:43 4434 1
原创 约瑟夫问题用链表实现
头文件:函数的声明#include #include #include typedef int ElemType;typedef struct Node{ ElemType data; struct Node* next;}ListNode,*LinkList;LinkList CreateCycList(int n);void Josephus(LinkList he
2015-02-05 00:48:21 522
原创 有两个循环单链表,头指针分别是head1和head2,实现算法将链表head2连接到head1之后,连接后的链表仍然是循环链表的形式
头文件:函数的声明#include #include #include typedef int ElemType;typedef struct Node { ElemType data; struct Node* next;}ListNode,*LinkList;LinkList CreateCycList(int n);//创建循环单链表void DisplayCyc
2015-02-05 00:44:44 5661
原创 Algorithm Gossip: m元素集合的n个元素子集
/**************************************** * File Name : arithmetic.c * Creat Data : 2015.2.4* Author : ZY *****************************************/ /*Algorithm Gossip: m元素集合的n个元素子集*
2015-02-04 17:05:37 492
转载 Algorithm Gossip: 格雷码(Gray Code)
/**************************************** * File Name : arithmetic.c * Creat Data : 2015.2.4* Author : ZY *****************************************/ /*Algorithm Gossip: 格雷码(Gray Code)
2015-02-04 17:04:03 513
原创 Algorithm Gossip: 4N 魔方阵
/**************************************** * File Name : arithmetic.c * Creat Data : 2015.2.4* Author : ZY *****************************************/ /*Algorithm Gossip: 4N 魔方阵*//*与奇数魔
2015-02-04 17:01:56 539
Windows_Git_64bit
2016-07-09
windows_svn_64bit
2016-07-09
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人