摘要: Given two integersnandk, return all possible combinations ofknumbers out of 1 ...n.For example,Ifn= 4 andk= 2, a solution is:[ [2,4], [3,4], [2,3],... 阅读全文
posted @ 2015-09-10 20:54 舒克_贝塔 阅读(145) 评论(0) 推荐(0) 编辑
摘要: Given amxngrid filled with non-negative numbers, find a path from top left to bottom right whichminimizesthe sum of all numbers along its path.Note:Yo... 阅读全文
posted @ 2015-09-10 10:37 舒克_贝塔 阅读(139) 评论(0) 推荐(0) 编辑
摘要: Givennnon-negative integersa1,a2, ...,an, where each represents a point at coordinate (i,ai).nvertical lines are drawn such that the two endpoints of ... 阅读全文
posted @ 2015-09-10 09:22 舒克_贝塔 阅读(104) 评论(0) 推荐(0) 编辑
摘要: 1 bool is_sqrt(int n){ 2 for(int i=1;i=i/2;--j){23 a[i] = a[i]<(a[j]+a[i-j])?a[i]:(a[j]+a[i-j]);24 }25 }26 int temp =... 阅读全文
posted @ 2015-09-10 08:20 舒克_贝塔 阅读(711) 评论(0) 推荐(0) 编辑
摘要: #include#includeusing namespace std;//链表的归并排序struct listnode{ int value; listnode* next; listnode(int value):value(value),next(NULL){}};listn... 阅读全文
posted @ 2015-09-09 22:50 舒克_贝塔 阅读(241) 评论(0) 推荐(0) 编辑
摘要: 一、先来先服务和短作业(进程)优先调度算法1.先来先服务调度算法先来先服务(FCFS)调度算法是一种最简单的调度算法,该算法既可用于作业调度,也可用于进程调度。当在作业调度中采用该算法时,每次调度都是从后备作业队列中选择一个或多个最先进入该队列的作业,将它们调入内存,为它们分配资源、创建进程,然后放... 阅读全文
posted @ 2015-09-08 16:49 舒克_贝塔 阅读(208) 评论(0) 推荐(0) 编辑
摘要: 给定一个字符串,输出最长的重复子串举例:ask not what your countrycan do for you,but what youcan do for yourcountry最长的重复子串:can do for you思路:使用后缀数组解决分析:1、由于要求最长公共子序列,则需要找到字... 阅读全文
posted @ 2015-09-06 00:01 舒克_贝塔 阅读(1064) 评论(0) 推荐(0) 编辑
摘要: 转:http://bbs.chinaunix.net/thread-1281954-1-1.html二动态链接库的特点与优势首先让我们来看一下,把库函数推迟到程序运行时期载入的好处:1.可以实现进程之间的资源共享。 什么概念呢?就是说,某个程序的在运行中要调用某个动态链接库函数的时候,操作系统首先会... 阅读全文
posted @ 2015-09-05 10:01 舒克_贝塔 阅读(338) 评论(0) 推荐(0) 编辑
摘要: 参考他人思路而写,具体可参考:http://blog.csdn.net/anialy/article/details/7620469 1 #ifndef _HASHTABLE_ 2 #define _HASHTABLE_ 3 #include 4 using namespace std; ... 阅读全文
posted @ 2015-09-04 22:59 舒克_贝塔 阅读(192) 评论(0) 推荐(0) 编辑
摘要: 1 /* 2 如果两个字符串的字符一样,但是顺序不一样,被认为是兄弟字符串, 3 问如何在迅速匹配兄弟字符串(如,bad和adb就是兄弟字符串)。 4 */ 5 #include 6 using namespace std; 7 8 int isBroStr(char *... 阅读全文
posted @ 2015-09-03 21:04 舒克_贝塔 阅读(585) 评论(0) 推荐(0) 编辑