自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(13)
  • 收藏
  • 关注

原创 线索二叉树

#include <stdio.h>#include <stdlib.h>typedef char ElemType;typedef enum{Link,Thread} PointerTag;typedef struct BiThrNode{ ElemType data; PointerTag ltag,rtag; struct BiThrNode *lchild,*rchild; }BiThrNode,*BiThrTree;BiThrTree

2021-08-28 17:55:16 55

原创 二叉树建立和遍历

#include <stdio.h>#include <stdlib.h>//结构typedef struct BiTNode{ char data; struct BiTNode *lchild,*rchild;}BiTNode,*BiTree;//创建二叉树void CreateBiTree(BiTree *T){ char c; scanf("%c",&c); if(c==' '){ *T=NULL;

2021-08-25 09:20:23 57

原创 汉诺塔问题

汉诺塔通过递归方法实现,可以将n个盘子依次的变成n-1个盘子,每次调用函数时,就是将盘子插在x,y,z不同位置上,通过对x,y,z位置进行改变解决问题。假设盘子最初都插在x上,主要是三个步骤:将n-1个盘子借助z移到y上将x上的最后一个盘子移到z上将y上的盘子借助x移到z上void move(int n,char x,char y,char z){ if(n==1){ printf("%c-->%c\n",x,z); } else{

2021-08-24 11:53:16 57

原创 KMP算法

KMP算法主要是对两个字符串匹配问题发明的算法,是D.E.Knuth、J.H.Morris和V.R.Pratt三位前辈的研究结果。代码如下:#include <stdio.h>#include <stdlib.h>1.获取next数组:typedef char* String;void get_next(String T,int next[10]){ int j=0,i=1; next[1]=0; while(i<T[0]){

2021-08-24 11:39:13 46

原创 链式队列结构及实现

#include <stdio.h>#include <stdlib.h>#define error 0#define ok 11.结构typedef struct QNode{ int data; struct QNode *next;}QNode,*QueuePrt;typedef struct{ QueuePrt front,rear;}LinkQueue;2.初始化int initQueue(LinkQueue *q){

2021-08-21 18:38:09 58

原创 队列的结构及实现

#include <stdio.h>#include <stdlib.h>#define error 0#define ok 1#define MAXSIZE 101.结构typedef struct cycleQueue{ int *base; int front; int rear;}cycleQueue;2.初始化int initQueue(cycleQueue *q){ q->base=(int *)malloc(

2021-08-21 18:28:13 44

原创 折半查找法

使用递归实现折半查找,主函数可以根据自己的需要进行修改,这里只是为了调试方便。med()函数返回值是要查找的数值在数组中的位置。#include <stdio.h>#include <stdlib.h>int med(int low,int high,int n,int a[5]){ int mid=(low+high)/2; if(low>=high){ return 0; } else if(a[mid]>n){

2021-08-21 18:21:33 89

原创 二进制转十进制-栈

#include <stdio.h>#include <stdlib.h>#include <math.h>#define error 0#define ok 1#define MAXSIZE 10#define STACKINCREMENT 101.结构typedef struct sqStack{ int *base; int *top; int stackSize;}sqStack;2.初始化int initSta

2021-08-21 08:51:11 73

原创 循环链表-约瑟夫

#include <stdio.h>#include <stdlib.h>#define error 0#define ok 11.结构(循环链表)typedef struct Node{ int data; struct Node *next;}Node,*LNode;2.初始化int InitList(LNode *L){ int item=1; LNode p,target; *L=(LNode)malloc(siz

2021-08-21 08:44:00 51

原创 单链表求中间节点

#include <stdio.h>#include <stdlib.h>#include <time.h>#define error 0#define ok 11.结构typedef struct Node{ int data; struct Node *next;}Node;typedef struct Node* LinkList;2.创建链表int CreateListHead(LinkList *L,int n){

2021-08-19 19:41:36 123

原创 单链表的实现

#include <stdio.h>#include <stdlib.h>#include <time.h>#define error 0#define ok 11.结构typedef struct Node{ int data; struct Node *next;}Node;typedef struct Node* LinkList;2.初始化//头插法创建n个元素的链表int CreateListHead(LinkList

2021-08-19 10:31:09 29

原创 静态链表的实现

#include <stdio.h>#include <stdlib.h>#define MAXSIZE 10#define error 0#define ok 11.例子// 游标 5 2 3 4 0 6 7 ... 1// 数据 A C D E ...// 下标 0 1 2 3 4 5 6 ... 92.结构typedef struct{

2021-08-19 10:24:00 36

原创 线性表

线性表本篇文章是对线性表创建以及插入、删除元素等功能的编写。#include <stdio.h>#include <stdlib.h>#define MAXSIZE 10 //容纳的元素个数#define false 0#define true 1#define error 0#define ok 11.定义表的结构typedef struct{ /* data */ int *elem; int listSize; int l

2021-08-18 10:42:31 75

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除