1. 
归并排序原理:有长度为n的子序列a[n],可以将其看做n个长度为1的子序列,将相邻子序列两两归并后子序列数量减少一半,再对子序列进行两两归并,数量又减少一般,重复直到得到一个长度为n的子序列2. 
实现归并操作的代码如下:/*array[s…m]和array[m+1…t]均已各自有序,合并使得a...
                            
                            
                                分类:
其他好文   时间:
2014-05-10 00:28:40   
                                阅读次数:
382
                             
                    
                        
                            
                            
                                Say you have an array for which theithelement 
is the price of a given stock on dayi.Design an algorithm to find the maximum 
profit. You may complete a...
                            
                            
                                分类:
其他好文   时间:
2014-05-10 00:24:49   
                                阅读次数:
255
                             
                    
                        
                            
                            
                                Array.prototype.slice.call(document.links,0).forEach(function(link){link.onmousedown 
= null})插件总失效 用这个对付下
                            
                            
                                分类:
其他好文   时间:
2014-05-10 00:15:19   
                                阅读次数:
250
                             
                    
                        
                            
                            
                                1 def quick_sort(a) 2 3 return a if a.size x}) : [] 
6 7 end 8 9 array = [72,6,57,88,60,42,83,73,42,48,85] 10 11 p quick_sort(array) 
#=> [6...
                            
                            
                                分类:
其他好文   时间:
2014-05-09 13:43:49   
                                阅读次数:
318
                             
                    
                        
                            
                            
                                PHP 
支持八种原始类型。四种标量类型:布尔型(boolean)整型(integer)浮点型(float)(浮点数,也作“double”)字符串(string)两种复合类型:数组(array)对象(object)最后是两种特殊类型:资源(resource)NULL为了确保代码的易读性,本手册还介绍了...
                            
                            
                                分类:
Web程序   时间:
2014-05-09 13:19:34   
                                阅读次数:
388
                             
                    
                        
                            
                            
                                Say you have an array for which theithelement 
is the price of a given stock on dayi.If you were only permitted to complete at 
most one transaction (ie...
                            
                            
                                分类:
其他好文   时间:
2014-05-09 13:13:02   
                                阅读次数:
283
                             
                    
                        
                            
                            
                                一、冒泡排序冒泡排序算是最基础的一种算法了,复杂度为O(N^2),其基本思想是:从最低端数据开始,两两相邻比较,如果反序则交换。代码如下:/*最基本的冒泡排序*/void 
BubbleSort1 (int n, int *array) /*little > big*/{ int i, j...
                            
                            
                                分类:
其他好文   时间:
2014-05-09 13:02:57   
                                阅读次数:
319
                             
                    
                        
                            
                            
                                一点小错,两次过,基本思想是先比较头元素,哪个小就在哪个list的基础上插入,需要考虑两种不同的结束方式 1 
/** 2 * Definition for singly-linked list. 3 * public class ListNode { 4 * int 
val; 5 *...
                            
                            
                                分类:
其他好文   时间:
2014-05-09 09:21:59   
                                阅读次数:
273
                             
                    
                        
                            
                            
                                戳我去解题Write an efficient algorithm that searches for 
a value in anmxnmatrix. This matrix has the following properties:Integers in 
each row are sorted f...
                            
                            
                                分类:
其他好文   时间:
2014-05-09 08:27:24   
                                阅读次数:
241
                             
                    
                        
                            
                            
                                原地归并。下面是AC代码: 1 public void merge(int A[], int m, 
int B[], int n) { 2 3 int len = A.length; 4 //first copy m elements of A...
                            
                            
                                分类:
其他好文   时间:
2014-05-09 05:59:54   
                                阅读次数:
297