贪心算法简单示例:leetcode——455. 分发饼干

摘要: 假设你是一位很棒的家长,想要给你的孩子们一些小饼干。但是,a56爆大奖在线娱乐孩子最多只能给一块饼干。 对a56爆大奖在线娱乐孩子 i,都有一个胃口值 g[i],这是能让孩子们满足胃口的饼干的最小尺寸;并且每块饼干 j,都有一个尺寸 s[j] 。如果 s[j] >= g[i],a56爆大奖在线娱乐们可以将这个饼干 j 分配给孩子 i ,这个孩子会得 阅读全文
posted @ 2021-03-07 11:57 平ping 阅读(79) 评论(0) 推荐(0) 编辑

Leetcode746. 使用最小花费爬楼梯

摘要: /*Leetcode746. 使用最小花费爬楼梯*/ #define MIN(a,b) ((a)<(b)?(a):(b)) int minCostClimbingStairs(int* cost, int costSize) { int *minCost = (int *)calloc(costSi 阅读全文
posted @ 2021-03-06 21:47 平ping 阅读(66) 评论(0) 推荐(0) 编辑

cp -r的linux C语言实现

摘要: #include<stdio.h> #include<sys/types.h> #include<sys/stat.h> #include<fcntl.h> #include<unistd.h> #include<string.h> #include<dirent.h> #define ARGS_C 阅读全文
posted @ 2021-02-24 21:42 平ping 阅读(457) 评论(0) 推荐(0) 编辑

makefile简单的笔记

摘要: 初步: main:main.o func.o gcc mian.o func.o -o main #生成main函数 main.o:mian.c gcc -c main.c -o main.o #生成main.o func.o:func.c gcc -c func.c -o func.o #生成fu 阅读全文
posted @ 2021-02-22 22:18 平ping 阅读(64) 评论(0) 推荐(0) 编辑

todo

摘要: 参考: https://book.douban.com/review/5164571/#comments 以下的原则,是a56爆大奖在线娱乐在工作中总结的: 复制代码是危险的。如果有两段相同的代码,几乎可以说一定是有问题的,因为每次改动,要维护两段代码 ?尽量减少IO操作,如操作数据库,网络发送,甚至printf , 阅读全文
posted @ 2021-02-21 16:15 平ping 阅读(111) 评论(0) 推荐(0) 编辑

汇编相关

摘要: 寄存器 汇编指令 push_*_ 压栈 (l:16位,q:32位) pop_*_ 弹栈 (l:16位,q:32位) mov_*_(from,to) 移动 * 位的数据 (l:16位,q:32位) call 调用函数 ret 返回 lea_*_(from,to) 将from的地址加载到to中 (l:1 阅读全文
posted @ 2021-02-20 23:19 平ping 阅读(46) 评论(0) 推荐(0) 编辑

七大排序——C实现

摘要: #include<stdio.h> #include<stdlib.h> #include<string.h> #include<time.h> #define MAX_NUM_SIZE 20000000 #define MAX_RANDOM_NUM 100 #define SWAP(a,b){in 阅读全文
posted @ 2021-02-16 21:50 平ping 阅读(44) 评论(0) 推荐(0) 编辑

C语言——txt词频统计

摘要: 1 #define _CRT_SECURE_NO_WARNINGS 2 #include<stdio.h> 3 #include<stdlib.h> 4 #include<string.h> 5 #define MAXKEY 2000 6 #define MAX_WORD_SIZE 30 7 8 i 阅读全文
posted @ 2021-02-09 18:02 平ping 阅读(230) 评论(0) 推荐(0) 编辑

C——qsort()排序指针数组的概括用法

摘要: qsort( 【* 指针,解引用后指向的是 等待排序的元素的类型 的指针数组 】,【count,数组中的指针解引用后的元素的数量】,【size,数组中的指针解引用后的元素的大小】 ,compare 【compare是回调函数,没有()】) int compare(const void *p1,con 阅读全文
posted @ 2021-02-06 21:41 平ping 阅读(240) 评论(0) 推荐(0) 编辑

C——数组元素的二叉树创建

摘要: 1 int main() { 2 char c[] = "ABCDEFGHIJ"; 3 pTreeNode_t pArr[MAX_SIZE_OF_TREE]; 4 for (int i = 0; i < MAX_SIZE_OF_TREE; i++) { 5 pArr[i] = (pTreeNode_ 阅读全文
posted @ 2021-02-03 23:58 平ping 阅读(149) 评论(0) 推荐(0) 编辑