Mergeksorted linked lists and return it as one
sorted list. Analyze and describe its
complexity.思路:合并k个有序链表为一个有序链表。我们可以用先合并两个链表的方法,然后逐个遍历链表数组,与上一个合并结束...
分类:
其他好文 时间:
2014-05-12 15:07:06
阅读次数:
305
摘自:http://www.2cto.com/kf/201306/218838.html1、jQuery自带的$.map方式:$.map(json,
function (n) { return n; });这种方式原来用于复制数组还可以,今天用它复制数组中的某一条记录,发现字段名称丢失了,后来发现了...
分类:
Web程序 时间:
2014-05-12 13:30:24
阅读次数:
437
class Solution {public: int
maximalRectangle(vector > &matrix) { int rows = matrix.size(); if (rows
== 0) return 0; int cols =...
分类:
其他好文 时间:
2014-05-12 09:54:05
阅读次数:
250
坑爹地多次过,全都是写程序时不注意的小问题,书写习惯还需要进一步改善。遇到的bug有:忘记return语句;定义ListNode
runner = head.next,却将判断head==null的情况放在这句之后;
忘记了新的head将不会是原来的那个head,而是head.next;所以以后遇到...
分类:
其他好文 时间:
2014-05-10 06:59:37
阅读次数:
320
1. int cmp(const void *x,const void *y) {return
*(int*)y-*(int*)x;}//非增序
qsort(a,n,sizeof(a[0]),cmp);//参数分别为(首位置,个数,大小,比较函数)(后续更新)2.int num=unique(a,....
分类:
其他好文 时间:
2014-05-10 05:29:43
阅读次数:
284
1/**2*数组乱序类3*@authornoam4*/5publicclassNRandom{67/**8*对给定数目的自0开始步长为1的数字序列进行乱序9*@paramno给定数目10*@return乱序后的数组11*/12publicstaticint[]getSequence(intno){1...
分类:
其他好文 时间:
2014-05-10 05:24:18
阅读次数:
243
int BubbleSort(int a[]){ int length =
sizeof(a)/sizeof(int); int i,j; int temp; for(i = 0;i i;j--) { if(a[j] <
a[j-1]) { ...
分类:
其他好文 时间:
2014-05-10 03:24:40
阅读次数:
233
转载void CTestDlg::DeleteDirectory(CString
strDir){ if(strDir.IsEmpty()) return; //首先删除文件及子文件夹 CFileFind ff; BOOL bFound =
ff...
分类:
其他好文 时间:
2014-05-10 03:01:13
阅读次数:
292
/** * 转换图片成圆形 * * @param bitmap * 传入Bitmap对象 *
@return */ public static Bitmap toRoundBitmap(Bitmap bitmap)...
分类:
移动开发 时间:
2014-05-10 02:46:10
阅读次数:
436
/**
*
* @param c
* for example Person.class
* @param primaryKeys
* primaryKeys为主键,参数顺序和表中保持一致 如果id, name 为主键 类名为Person 则 getEntity(Person.class,1,"name")
* @return
...
分类:
数据库 时间:
2014-05-09 21:15:10
阅读次数:
422