Question:There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity s...
                            
                            
                                分类:
其他好文   时间:
2014-06-21 08:34:52   
                                阅读次数:
172
                             
                    
                        
                            
                            
                                循环有序 一共有以下两种情况 第一种 / / // / / 条件:(A[mid] >= A[low]) ,low~mid 二分,mid~high 递归第二种 / / / / / / 条件:(A[mid] A[mid])12 ...
                            
                            
                                分类:
其他好文   时间:
2014-06-19 06:46:36   
                                阅读次数:
303
                             
                    
                        
                            
                            
                                Follow up for "Search in Rotated Sorted Array":What ifduplicatesare allowed?Would this affect the run-time complexity? How and why?Write a function to...
                            
                            
                                分类:
其他好文   时间:
2014-06-18 20:54:36   
                                阅读次数:
202
                             
                    
                        
                            
                            
                                There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be ...
                            
                            
                                分类:
其他好文   时间:
2014-06-18 17:39:11   
                                阅读次数:
260
                             
                    
                        
                            
                            
                                Given two sorted integer arrays A and B, merge B into A as one sorted array.
Note:
You may assume that A has enough space (size that is greater or equal to
m + n) to 
hold additional ele...
                            
                            
                                分类:
其他好文   时间:
2014-06-17 23:05:13   
                                阅读次数:
246
                             
                    
                        
                            
                            
                                题目
Merge k sorted
 linked lists and return it as one sorted list. Analyze and describe its complexity.
方法
使用归并排序的思想,两两合并,直到最终变成一个。
		    public ListNode mergeKLists(ArrayList lists) {...
                            
                            
                                分类:
其他好文   时间:
2014-06-17 21:34:41   
                                阅读次数:
183
                             
                    
                        
                            
                            
                                二叉查找树(Binary Search Tree),也称二叉排序树(binary sorted tree),是指一棵空树或者具有下列性质的二叉树:若任意节点的左子树不空,则左子树上所有结点的值均小于它的根结点的值任意节点的右子树不空,则右子树上所有结点的值均大于它的根结点的值任意节点的左、右子树也分...
                            
                            
                                分类:
其他好文   时间:
2014-06-16 23:32:04   
                                阅读次数:
199
                             
                    
                        
                            
                            
                                没什么太多讲的,可以使用递归和迭代两种方法来做,要仔细考虑各种输入情况。code如下:...
                            
                            
                                分类:
其他好文   时间:
2014-06-15 15:09:59   
                                阅读次数:
145
                             
                    
                        
                            
                            
                                Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:
Integers in each row are sorted from left to right.The first integer of each...
                            
                            
                                分类:
其他好文   时间:
2014-06-15 14:12:44   
                                阅读次数:
238
                             
                    
                        
                            
                            
                                Follow up for ”Remove Duplicates”: What if duplicates are allowed at most twice?For example, Given sorted array A = [1,1,1,2,2,3],Your function should...
                            
                            
                                分类:
其他好文   时间:
2014-06-14 16:08:32   
                                阅读次数:
200