//counting sort 
计数排序//参考算法导论8.2节#include#include#include#includeusing namespace std;const int 
k=5;const int n=7;int a[n]={5, 5, 1, 2 , 5, 4, 1};int b[...
                            
                            
                                分类:
其他好文   时间:
2014-06-12 23:08:11   
                                阅读次数:
237
                             
                    
                        
                            
                            
                                package chap08_Linear_Time_Sort;import static 
org.junit.Assert.*;import java.util.Arrays;import org.junit.Test;public class 
CopyOfSortAlgorithms { /**...
                            
                            
                                分类:
其他好文   时间:
2014-06-12 20:32:16   
                                阅读次数:
231
                             
                    
                        
                            
                            
                                当集合或数组内的对象需要排序时,会利用Collections.sort或Arrays.sort来进行排序,通常会implement 
Comparable,来实现自定义排序,透过回传值来表示排序的大小。
                            
                            
                                分类:
编程语言   时间:
2014-06-12 19:33:37   
                                阅读次数:
239
                             
                    
                        
                            
                            
                                Question:Sort a linked list inO(nlogn) time 
using constant space complexity.Solution:Merge sort.找到链表的中间的那个ListNode. 1 /** 2 
* Definition for singly-l....
                            
                            
                                分类:
其他好文   时间:
2014-06-12 17:59:34   
                                阅读次数:
285
                             
                    
                        
                            
                            
                                1. order by id desc desc : 降序,也就是从大到小,asc 升序 
就是从小到大2. 当有多个字段排序时: 比如: order by id desc,sort desc; 优先按id 降序排序,如果id相同的话再按sort 
降序排序 如果id是主键或者是唯一的 那么后面的...
                            
                            
                                分类:
数据库   时间:
2014-06-12 09:30:33   
                                阅读次数:
219
                             
                    
                        
                            
                            
                                问题:对链表进行排序,要求时间复杂度为NlogN。归并排序。
 inline ListNode* getMidle(ListNode *head){
	if(NULL == head || NULL == head->next)
		return head;
	ListNode *pslow = head;
	ListNode *pfast = head;
	while (pfast->next...
                            
                            
                                分类:
其他好文   时间:
2014-06-10 17:35:56   
                                阅读次数:
282