2019年1月11日

将博客搬至CSDN

摘要: xxxx 阅读全文

posted @ 2019-01-11 11:17 yi_meng 阅读(267) 评论(0) 推荐(0) 编辑

2014年9月11日

《转》二进制与三进制的那些趣题

摘要: http://blog.csdn.net/zhuxiaoyang2000/article/details/6091767先来思考几个问题,并不难,各位大牛应能秒杀:1. 小明是个卖苹果的,小红一次在小明那买N(N第二次称量时天平不平衡,那么我们可以肯定异样小球必然在第二位编号为1或2的小球中,Y等于... 阅读全文

posted @ 2014-09-11 20:43 yi_meng 阅读(326) 评论(0) 推荐(0) 编辑

2014年9月5日

二叉树遍历 (前序 层次 == 深度 广度) 层次遍历

摘要: #include#include#include#includeusing namespace std;struct Node;//二叉树节点 class Node{ public: Node(int node):parent(NULL),left(NULL),right(NUL... 阅读全文

posted @ 2014-09-05 09:48 yi_meng 阅读(335) 评论(0) 推荐(0) 编辑

2014年9月4日

数组全排列 knuth 分解质因数

摘要: templatevoid swap(T* a, T* b){ T temp = *a; *a = *b; *b = temp;}//数组的全排列void perm(int list[], int k, int m){ if (k==m) { copy(list,list+m... 阅读全文

posted @ 2014-09-04 19:41 yi_meng 阅读(545) 评论(0) 推荐(0) 编辑

2014年8月26日

堆排序

摘要: //堆排序//①维护堆 void max_heapify(int *ptr,int index,int len){ index = index + 1; int left = index ptr[index - 1]) largest = left; if(righ... 阅读全文

posted @ 2014-08-26 10:40 yi_meng 阅读(134) 评论(0) 推荐(0) 编辑

2014年8月25日

双向快速排序

摘要: #include using namespace std;void swap(int* p,int* q){ int temp = *p; *p = *q; *q = temp;}//快速排序int partition(int *ptr,int first, int last){ ... 阅读全文

posted @ 2014-08-25 20:32 yi_meng 阅读(734) 评论(0) 推荐(0) 编辑

二路归并排序

摘要: #include using namespace std;void merge(int* ptr,int first, int mid, int last){ int len = last - first + 1; int *temp = new int[len]; ... 阅读全文

posted @ 2014-08-25 19:04 yi_meng 阅读(209) 评论(0) 推荐(0) 编辑

2014年6月6日

字符串的排列

摘要: 字符串排列 阅读全文

posted @ 2014-06-06 23:04 yi_meng 阅读(285) 评论(0) 推荐(0) 编辑

2014年5月22日

curses.h头文件不存在解决办法

摘要: sudoapt-getinstalllibncurses5-dev安装,系统自带库文件一般在/usr/include下面,这个是安装curses.h的conio不是c语言标准库,也不是posix标准,如果楼主实在要用,http://download.csdn.net/detail/tianshuai... 阅读全文

posted @ 2014-05-22 22:40 yi_meng 阅读(1394) 评论(0) 推荐(0) 编辑

2014年5月4日

求字符串2是是否是字符串1的字串

摘要: templateT my_search(T first1, T last1, T first2, T last2){ int d1 = distance(first1, last1); int d2 = distance(first2, last2); if(d1 < d2) ... 阅读全文

posted @ 2014-05-04 11:00 yi_meng 阅读(469) 评论(0) 推荐(0) 编辑

导航