码迷,mamicode.com
首页 >  
搜索关键字:sort    ( 12890个结果
counting sort 计数排序
//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
第八章 线性时间排序 8.3 基数排序
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
Effective Java实作Comparable - 就是爱Java
当集合或数组内的对象需要排序时,会利用Collections.sort或Arrays.sort来进行排序,通常会implement Comparable,来实现自定义排序,透过回传值来表示排序的大小。
分类:编程语言   时间:2014-06-12 19:33:37    阅读次数:239
[Leetcode] Sort List
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
冒泡排序 选择排序 插入排序 java
双向冒泡 1 package com.huang; 2 3 public class _014_bubb_sort { 4 5 int[] b={1,2}; 6 static int a[]={12,4,35,65,43,63,2,6,9,544,43543}; 7 pu...
分类:编程语言   时间:2014-06-10 21:43:40    阅读次数:275
【leetcode】sort list
问题:对链表进行排序,要求时间复杂度为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
第六章 堆排序 6.5 优先队列
package chap06_Heap_Sort;import static org.junit.Assert.*;import java.util.ArrayList;import java.util.Arrays;import org.junit.Test;/** * 优先队列,二叉堆数组实现,...
分类:其他好文   时间:2014-06-10 16:40:14    阅读次数:347
第六章 堆排序
以后尽量能用迭代就别用递归啊,递归只是让自己轻松了,但是却增加了电脑的负担。 package chap06_Heap_Sort;import static org.junit.Assert.*;import java.util.Arrays;import org.junit.Test;public ...
分类:其他好文   时间:2014-06-10 11:57:27    阅读次数:252
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!