随笔分类 -  数据结构与算法

摘要:时间优先的方式实现数据的压缩、解压缩 #define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <stdlib.h> #include <string.h> // "aaaaabbbhaihualovefangfangooooooooo" 阅读全文
posted @ 2020-08-04 16:22 ant_colonies 阅读(286) 评论(0) 推荐(0)
摘要:硬盘检索 将硬盘中的文件逐行读入内存进行检索,速度慢 #define _CRT_SECURE_NO_WARNINGS #include <stdlib.h> #include <stdio.h> #include <string.h> #include <time.h> char path[256] 阅读全文
posted @ 2020-08-02 17:40 ant_colonies 阅读(176) 评论(0) 推荐(0)
摘要:数据结构中的栈——先进后出,先进先出 数据结构中的堆——堆的本质是一个二叉树,包括二分法查找,朗格朗日差值查找,堆排序查找极值 结构体 void main006() { struct myStruct // 结构体的意义:将多种类型的数据整合在一起 { int a[10]; int i; }; st 阅读全文
posted @ 2020-07-25 11:40 ant_colonies 阅读(156) 评论(0) 推荐(0)
摘要:时间种子的随机数的生成,需要#include <time.h>。 #include <time.h> time_t ts; unsigned int num = time(&ts); srand(num); // 或者 srand((unsigned int)(time(NULL))); 时间变化的 阅读全文
posted @ 2020-07-20 15:39 ant_colonies 阅读(156) 评论(0) 推荐(0)
摘要:0001、选择排序法 1 #include <stdio.h> 2 #include <stdlib.h> 3 #include <time.h> 4 #define N 20 5 6 7 void main() 8 { 9 time_t ts; 10 srand((unsigned int)tim 阅读全文
posted @ 2020-07-19 08:20 ant_colonies 阅读(308) 评论(0) 推荐(0)
摘要:001、斐波那契数列 /* 斐波那契数列:f(n)=f(n-1)+f(n-2);其中f(1)=f(2)=1;*/ #include <stdio.h> #include <stdlib.h> /* 斐波那契数列:f(n)=f(n-1)+f(n-2);其中f(1)=f(2)=1; */ int Fib 阅读全文
posted @ 2020-07-18 09:28 ant_colonies 阅读(199) 评论(0) 推荐(0)