//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
双向冒泡 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
问题:对链表进行排序,要求时间复杂度为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
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
Sort a linked list using insertion sort. 1 /**
2 * Definition for singly-linked list. 3 * struct ListNode { 4 * int val; 5 *
ListNode *nex...
分类:
其他好文 时间:
2014-06-10 12:14:19
阅读次数:
253
以后尽量能用迭代就别用递归啊,递归只是让自己轻松了,但是却增加了电脑的负担。 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
binary search\sort\find operations
status InsertNode(Node* root, data x, Node* father)
{
if(root==NULL)
{
if(father==NULL)
Tree empty;
else
{
if(xdata)
{
father->left=new Node//inital l...
分类:
其他好文 时间:
2014-06-10 08:09:49
阅读次数:
234