
数据结构
垆边人似月
人生道路上
感谢每一个走了的人
期待每一个到来的人
珍惜每一个身边的人
展开
-
单链表(头指针)
#include #include //malloc的头文件#define OK 0#define ERROR -1#define MALLOC_ERROR -2typedef int ElementType;typedef struct node{ ElementType data; //结原创 2017-08-04 20:24:14 · 756 阅读 · 0 评论 -
单链表(表头结点)
#include #include #define OK 0#define ERROR -1#define MALLOC_ERROR -2typedef int ElementType; //c语言中没有ElementType这个数据类型,讲数据结构时,用这个来泛指某一种数据类型typedef struct node{原创 2017-08-04 20:38:35 · 1627 阅读 · 0 评论 -
快速排序
#includevoid quicksort(int a[],int left,int right){ int i,j; if(left < right) { i = left; //left、right用于限定要排序数列的范围,temp即为中心元素 j = right; int temp = a[l原创 2017-08-05 18:59:50 · 287 阅读 · 0 评论 -
归并排序
归并排序(MERGE-SORT)是建立在归并操作上的一种有效的排序算法,该算法是采用分治法(Divide and Conquer)的一个非常典型的应用。将已有序的子序列合并,得到完全有序的序列;即先使每个子序列有序,再使子序列段间有序。若将两个有序表合并成一个有序表,称为二路归并。归并过程为:比较a[i]和b[j]的大小,若a[i]≤b[j],则将第一个有序表中的元素a[i]复制到r[k]原创 2017-08-05 19:03:06 · 319 阅读 · 0 评论 -
基数排序
#include#includeint getlooptimes(int num){ int count = 1; int temp = num/10; while(temp!=0) { count++; temp = temp/10; } return count;}int findmaxnum(int *p,int n){ int i; int max原创 2017-08-05 19:03:47 · 323 阅读 · 0 评论