排序算法
文章平均质量分 73
各种排序算法
dijk
这个作者很懒,什么都没留下…
展开
-
Internal Sorting: Radix List Sort: Sorting by Distribution
Algorithm RAlgorithm R (Radix list sort). Records R1,…, RN are each assumed to contain a LINK field. Their keys are assumed to be p-tuples (a1,a2,…,ap),原创 2015-05-31 14:13:51 · 647 阅读 · 0 评论 -
Internal Sorting: List Merge Sort: Sorting by Merging
Algorithm LAlgorithm L (List merge sort). Records R1, … , RN are assumed to contain keys K1,…, KN, together with link fields L1, …, LN capable of holding the numbers -(N + 1) through (N + 1). There原创 2015-05-31 14:35:09 · 724 阅读 · 0 评论 -
Internal Sorting: Radix exchange sort: Sorting by Exchanging
Algorithm RAlgorithm R (Radix exchange sort). Records R1,… ,RN are rearranged in place; after sorting is complete, their keys will be in order, K1 <= … <= KN. Each key is assumed to be a nonnegativ原创 2015-05-31 14:39:08 · 701 阅读 · 0 评论 -
Internal Sorting: Straight Two-way Merge Sort: Sorting by Merging
Algorithm SAlgorithm S (Straight two-way merge sort). Records R1,… ,RN are sorted using two memory areas as in Algorithm N. S1. [Initialize.] Set s <– 0, p <– 1. (For the significance of variables原创 2015-05-31 14:46:37 · 1162 阅读 · 0 评论 -
Internal Sorting: Natural Two-way Merge Sort: Sorting by Merging
Algorithm NAlgorithm N (Natural two-way merge sort). Records R1,…,RN are sorted using two areas of memory, each of which is capable of holding N records. For convenience, we shall say that the reco原创 2015-05-31 14:50:13 · 1224 阅读 · 0 评论 -
Internal Sorting: Heapsort-2:Sorting by Selection
Algorithm HAlgorithm H (Heapsort). Records R1,… ,RN are rearranged in place; after sorting is complete, their keys will be in order, K1<=…<=KN. First we rearrange the file so that it forms a heap,原创 2015-05-31 14:59:19 · 666 阅读 · 0 评论 -
Internal Sorting: Quicksort-2: Sorting by Exchanging
Algorithm QAlgorithm Q (Quicksort). Records R1,...,RNR_1,... ,R_N are rearranged in place; after sorting is complete their keys will be in order, K1<=...<=KNK_1<=...<=K_N. An auxiliary stack with a原创 2015-05-31 15:05:09 · 584 阅读 · 0 评论 -
Internal Sorting: Heapsort-1: Sorting by Selection
Heapsort-1:堆排序-1Animation A run of the heapsort algorithm sorting an array of randomly permuted values. In the first stage of the algorithm the array elements are reordered to satisfy the heap propert原创 2015-05-31 15:42:48 · 616 阅读 · 0 评论 -
Internal Sorting: Straight selection sort: Sorting by Selection
Straight selection sort:直接选择排序Animation Selection sort animation Selection sort animation. Red is current min. Yellow is sorted list. Blue is current item.Complexity Class Sorting algorithm Data原创 2015-05-31 15:48:22 · 766 阅读 · 0 评论 -
Internal Sorting: Radix sort: Sorting by Exchanging
Java program/** * Created with IntelliJ IDEA. * User: 1O1O * Date: 11/30/13 * Time: 10:01 PM * :)~ * Radix sort:Sorting by Exchanging:Internal Sorting */public class Main { public static voi原创 2015-05-31 15:52:05 · 603 阅读 · 0 评论 -
Internal Sorting: Quicksort-1:Sorting by Exchanging
Quicksort-1:快速排序-1Animation nimated visualization of the quicksort algorithm. The horizontal lines are pivot values. Full example of quicksort on a random set of numbers. The shaded element is the pi原创 2015-05-31 16:15:11 · 520 阅读 · 0 评论 -
Internal Sorting: Merge exchange sort: Sorting by Exchanging
Algorithm MAlgorithm M (Merge exchange). Records R1,...,RNR_1,..., R_N are rearranged in place; after sorting is complete their keys will be in order, K1<=...<=KNK_1<=...<=K_N. We assume that N>=2N原创 2015-05-31 16:21:55 · 627 阅读 · 0 评论 -
Internal Sorting: Cocktail-shaker sort: Sorting by Exchanging
Cocktail-shaker sortAnimationComplexity Class Sorting algorithm Data structure Array Worst case performance O(n2)O(n^2) Best case performance O(n)O(n) Average case performance O(n2)O原创 2015-05-31 16:26:33 · 1145 阅读 · 0 评论 -
Internal Sorting: Bubble sort: Sorting by Exchanging
Bubble sort:冒泡排序Animation Static visualization of bubble sort An example of bubble sort. Starting from the beginning of the list, compare every adjacent pair, swap their position if they are not in t原创 2015-05-31 16:34:22 · 686 阅读 · 0 评论 -
Internal Sorting: Multiple list insertion: Sorting by Insertion
Data tableJava programIn this program, R1,…,RN were simplified to K1,…,KN./** * Created with IntelliJ IDEA. * User: 1O1O * Date: 11/25/13 * Time: 10:01 PM * :)~ * Multiple list insertion:Sorting原创 2015-05-31 16:38:12 · 577 阅读 · 0 评论 -
Internal Sorting: List insertion: Sorting by Insertion
Algorithm LAlgorithm L (List insertion). Records R1,...,RNR_1,..., R_N are assumed to contain keys K1,...,KNK_1,..., K_N, together with link fields L1,...,LNL_1,..., L_N capable of holding the number原创 2015-05-31 16:40:51 · 726 阅读 · 0 评论 -
Internal Sorting: Shellsort: Sorting by Insertion
Shellsort:希尔排序Animation Shellsort with gaps 23, 10, 4, 1 in action. The step-by-step process of replacing pairs of items during the shell sorting algorithm.Complexity Class Sorting algorithm Dat原创 2015-05-31 16:46:20 · 590 阅读 · 0 评论 -
Internal Sorting: Two-way insertion: Sorting by Insertion
Data tableJava program/** * Created with IntelliJ IDEA. * User: 1O1O * Date: 11/22/13 * Time: 10:01 PM * :)~ * Two-way insertion:Sorting by Insertion:Internal Sorting */public class Main { p原创 2015-05-31 16:50:15 · 585 阅读 · 0 评论 -
Internal Sorting: Binary insertion: Sorting by Insertion
Java program/** * Created with IntelliJ IDEA. * User: 1O1O * Date: 11/21/13 * Time: 10:01 PM * :)~ * Binary insertion:Sorting by Insertion:Internal Sorting */public class Main { public static原创 2015-05-31 16:53:18 · 546 阅读 · 0 评论 -
Internal Sorting: Straight insertion: Sorting by Insertion
Straight insertion sort:直接插入排序Animation Graphical illustration of insertion sort A graphical example of insertion sort. Animation of the insertion sort sorting a 30 element array.Complexity Class原创 2015-05-31 16:59:16 · 575 阅读 · 0 评论 -
Internal Sorting: Distribution counting: Sorting by counting
Algorithm DAlgorithm D (Distribution counting). Assuming that all keys are integers in the range u<=Kj<=vu<=K_j<=v for 1<j<N1< j < N, this algorithm sorts the records R1,...,RNR_1,..., R_N by making原创 2015-05-31 17:04:10 · 747 阅读 · 0 评论 -
Internal Sorting: Comparison counting: Sorting by counting
Algorithm CAlgorithm C (Comparison counting). This algorithm sorts R1,...,RNR_1 ,..., R_N on the keys K1,...,KNK_1,...,K_N by maintaining an auxiliary table COUNT[1],...,COUNT[N]COUNT[1],..., COUNT[N]原创 2015-05-31 17:08:24 · 698 阅读 · 0 评论 -
Odd-even sort: Sorting by Exchanging
Odd-even sortAnimation Example of odd-even transposition sort sorting a list of random numbersComplexity Class Sorting algorithm Data structure Array Worst case performance O(n2)O(n^2) Be原创 2015-11-10 20:03:47 · 941 阅读 · 0 评论 -
Comb sort: Sorting by Exchanging
Comb sortAnimation Visualisation of Comb sortComplexity Class Sorting algorithm Data structure Array Worst case performance O(n2)O(n^2) Best case performance O(n)O(n) Average case per原创 2015-11-12 10:08:56 · 706 阅读 · 0 评论 -
Gnome sort: Sorting by Exchanging
Gnome sortAnimation Visualisation of Gnome sortComplexity Class Sorting algorithm Data structure Array Worst case performance O(n2)O(n^2) Best case performance Ω(n)\Omega(n) Average c原创 2015-11-12 11:04:05 · 569 阅读 · 0 评论 -
Optimized Gnome sort: Sorting by Exchanging
Java program/** * User: >_< * Date: 11/12/15 * Time: 10:51 AM */public class OptimizedGnomeSort { public static void optimized_gnome_sort(int[] input){ int pos = 1; int last = 0;原创 2015-11-12 11:08:13 · 679 阅读 · 0 评论 -
Stooge sort: Sorting by Exchanging
Stooge sortAnimation Visualization of Stooge sort.Complexity Class Sorting algorithm Data structure Array Worst case performance O(nlog3/log1.5)O(n^{\log3 / \log1.5}) Worst case space com原创 2015-11-12 11:41:57 · 744 阅读 · 0 评论 -
Bogosort: Sorting by Exchanging
BogosortAnimation A possible, but improbable, single shuffle execution of the bogo sort algorithm.Complexity Class Sorting algorithm Data structure Array Worst case performance Unbounded原创 2015-11-12 12:59:04 · 695 阅读 · 0 评论 -
Bozosort: Sorting by Exchanging
Java programimport java.util.Random;/** * User: >_< * Date: 11/12/15 * Time: 1:04 PM */public class BozoSort { public static void random_swap(int[] input, int size){ Random random = new R原创 2015-11-12 13:29:36 · 621 阅读 · 0 评论