文章分类 -  数据结构和算法

KMP算法解释篇
摘要:初尝KMP算法--这个味道酸爽! 文章借鉴自http://www.cnblogs.com/c-cloud/p/3224788.html 1.kmp算法的原理: 本部分内容转自:http://www.ruanyifeng.com/blog/2013/05/Knuth%E2%80%93Morris%E2 阅读全文

posted @ 2016-08-09 20:02 A-祥子 阅读(184) 评论(0) 推荐(0)

查找一组数据中第n大的数的位置方法:
摘要:#define _CRT_SECURE_NO_WARNINGS#include<stdio.h>#include<stdlib.h>#include<string.h> //打印函数void Print(int *arr, int len){ int *p = arr; int n = len; w 阅读全文

posted @ 2016-08-09 16:54 A-祥子 阅读(602) 评论(0) 推荐(0)

C语言文件读写,单个字符读写,字符串读写,二进制码流读写
摘要:#define _CRT_SECURE_NO_WARNINGS#include<stdio.h>#include<stdlib.h>#include<string.h>#include<sys/types.h> struct Message{ char name[10]; char age; }; 阅读全文

posted @ 2016-08-09 13:06 A-祥子 阅读(4077) 评论(0) 推荐(1)

#法创建二叉树,NULL的地方输入‘#’
摘要:#define _CRT_SECURE_NO_WARNGINGS#include<stdio.h>#include<stdlib.h>#include<string.h> typedef struct bintree{ char c; struct bintree * lchild; struct 阅读全文

posted @ 2016-08-08 23:51 A-祥子 阅读(478) 评论(0) 推荐(0)

二叉树的拷贝和释放
摘要:#define _CRT_SECURE_NO_WARNGINGS#include<stdio.h>#include<stdlib.h>#include<string.h> typedef struct bintree{ char c; struct bintree * lchild; struct 阅读全文

posted @ 2016-08-08 20:33 A-祥子 阅读(279) 评论(0) 推荐(0)

二叉树的前序、中序、后序遍历,以及叶子数目,树的深度
摘要:#define _CRT_SECURE_NO_WARNGINGS#include<stdio.h>#include<stdlib.h>#include<string.h> typedef struct bintree{ char c; struct bintree * lchild; struct 阅读全文

posted @ 2016-08-08 19:51 A-祥子 阅读(332) 评论(0) 推荐(0)

几种基本排序算法(二)希尔,快排,归并------直接上代码
摘要:希尔排序: #include<stdio.h>#include<stdlib.h>#include<string.h>#include<time.h> #define Max 40//交换数据void swap(int *str, int pos1, int pos2){ int tmp = str 阅读全文

posted @ 2016-08-08 01:11 A-祥子 阅读(125) 评论(0) 推荐(0)

几种基本排序算法(一):冒泡,选择,插入------直接上代码
摘要:冒泡排序: #include<stdio.h>#include<stdlib.h>#include<string.h>#include<time.h> #define Max 10//交换数据void swap(int *str, int pos1, int pos2){ int tmp = str 阅读全文

posted @ 2016-08-07 11:25 A-祥子 阅读(309) 评论(0) 推荐(0)

双向链表的基本操作回顾(代码)
摘要:头文件: #ifndef DOUBLELINKLIST_H#define DOUBLELINKLIST_H #include<stdio.h>#include<stdlib.h> //链表结点typedef struct _DOUBLELISTNODE{ void* data; struct _DO 阅读全文

posted @ 2016-08-06 20:22 A-祥子 阅读(246) 评论(0) 推荐(0)

导航