数据结构
Duke的专栏
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
二叉树遍历(前序,中序,后序)
#include <stdio.h> #include <stdlib.h>#define MAXSIZE 20 //二叉树结点的结构体表示形式 typedef struct BitNode { char data; struct BitNode* left,*right; }BitTree;//栈的结构体表示形式 typedef struct stackelem {原创 2017-10-26 17:23:59 · 465 阅读 · 0 评论 -
循环队列的基本操作
VC6.0下写的:#include<stdio.h> #include<stdlib.h> #define MAXSIZE 100 typedef char datatype; typedef struct { datatype *base; //存储空间的基地址 int front; //记录队头的下标 int rear; //记录队尾下一个位原创 2017-11-19 17:58:57 · 898 阅读 · 0 评论 -
二叉树的基本运算
#include<stdio.h> #include<stdlib.h>//二叉树结点定义 typedef struct BT { char data; struct BT *lchild; struct BT *rchild; }BT;//建立二叉树(前序创建) BT *createtree() { BT *bt; char x; scanf("%c原创 2017-10-26 17:23:28 · 967 阅读 · 1 评论 -
栈的基本操作
#include<stdio.h> #include<stdlib.h>//栈结点的定义 typedef struct stacknode { char data; struct stacknode *next; }stacknode;//构造空栈 stacknode* creat_stack() { stacknode *top = NULL; return top原创 2017-10-26 08:10:03 · 701 阅读 · 0 评论 -
链表的增删改查
#include<stdio.h> #include<stdlib.h>#define true 1 #define false 0 int s = 0; //定义全局变量s接收查找数据的位置//结点类型定义 typedef struct linknode { char data; struct linknode *next; }Node;//构造链表(带头结点的尾插法建表原创 2017-10-25 18:03:08 · 991 阅读 · 0 评论 -
快速排序
库函数调用快速排序: -------------------------------------------------------------------------------- #include<stdio.h> #include<stdlib.h> int sort(const void *a, const void *b) { return *(int *)a - *(int *)原创 2017-10-25 20:49:48 · 284 阅读 · 0 评论 -
二分法插入排序
把一个数插入到已经排好序的数组中去: -------------------------------------------------------------------------------- // 二分插入排序 #include<stdio.h> #include<stdlib.h> int sort(const void *a, const void *b) { return *(原创 2017-10-25 20:51:23 · 588 阅读 · 0 评论 -
归并排序
#include<stdio.h> void mergearray(int a[], int first, int mid, int last,int temp[]) { int i = first, j = mid + 1; int m = mid, n = last; int k = 0; while (i <= m && j <= n) {原创 2017-10-25 20:52:48 · 312 阅读 · 0 评论 -
堆排序
include <stdio.h> //array是待调整的堆数组,i是待调整的数组元素的位置,nlength是数组的长度 //本函数功能是:根据数组array构建大根堆 void HeapAdjust(int array[],int i,int nLength) { int nChild; int nTemp; for(;2*i+1<nLength;i=nChild)原创 2017-10-26 08:02:47 · 335 阅读 · 0 评论 -
希尔排序
#include<stdio.h> int main() { int a[10] = {49, 38, 65, 97, 26, 13, 27, 49, 55, 4}; int i, j, gap, n = 10; for (gap = n / 2; gap > 0; gap /= 2) { for (j = gap; j < n; j++)//从数组第原创 2017-10-26 08:03:27 · 282 阅读 · 0 评论 -
顺序栈的定义和基本算法
//顺序栈的定义和基本算法 #include<stdio.h> #include<stdlib.h> #define stacksize 100 typedef char datatype;//定义顺序栈 typedef struct { datatype data[stacksize]; int top; }seqstack;//置空栈 seqstack *initstack(se原创 2017-10-26 17:22:08 · 2036 阅读 · 0 评论 -
二叉树子系统
#include<stdio.h> #include<stdlib.h>typedef char datatype; typedef struct BitNode { datatype data; struct BitNode *lchild, *rchild; }BT;char sh = '0'; //判断是否为根结点BT *create_tree() { BT *b原创 2017-12-02 09:43:52 · 2206 阅读 · 0 评论
分享