Global Information Lookup Global Information

Comparison sort information


Sorting a set of unlabelled weights by weight using only a balance scale requires a comparison sort algorithm.

A comparison sort is a type of sorting algorithm that only reads the list elements through a single abstract comparison operation (often a "less than or equal to" operator or a three-way comparison) that determines which of two elements should occur first in the final sorted list. The only requirement is that the operator forms a total preorder over the data, with:

  1. if ab and bc then ac (transitivity)
  2. for all a and b, ab or ba (connexity).

It is possible that both ab and ba; in this case either may come first in the sorted list. In a stable sort, the input order determines the sorted order in this case.

Comparison sorts studied in the literature are "comparison-based".[1] Elements a and b can be swapped or otherwise re-arranged by the algorithm only when the order between these elements has been established based on the outcomes of prior comparisons. This is the case when the order between a and b can be derived via the transitive closure of these prior comparison outcomes.

For comparison-based sorts the decision to execute basic operations other than comparisons is based on the outcome of comparisons. Hence in a time analysis the number of executed comparisons is used to determine upper bound estimates for the number of executed basic operations such as swaps or assignments.[1]

A metaphor for thinking about comparison sorts is that someone has a set of unlabelled weights and a balance scale. Their goal is to line up the weights in order by their weight without any information except that obtained by placing two weights on the scale and seeing which one is heavier (or if they weigh the same).

  1. ^ a b Wilkes, M. V. (1974-11-01). "The Art of Computer Programming, Volume 3, Sorting and Searching". The Computer Journal. 17 (4): 324–324. doi:10.1093/comjnl/17.4.324. ISSN 0010-4620.

and 27 Related for: Comparison sort information

Request time (Page generated in 0.8722 seconds.)

Comparison sort

Last Update:

A comparison sort is a type of sorting algorithm that only reads the list elements through a single abstract comparison operation (often a "less than...

Word Count : 2635

Sorting algorithm

Last Update:

Whether or not they are a comparison sort. A comparison sort examines the data only by comparing two elements with a comparison operator. General method:...

Word Count : 6394

Bubble sort

Last Update:

during a pass, meaning that the list has become fully sorted. The algorithm, which is a comparison sort, is named for the way the larger elements "bubble"...

Word Count : 2318

Insertion sort

Last Update:

Insertion sort is a simple sorting algorithm that builds the final sorted array (or list) one item at a time by comparisons. It is much less efficient...

Word Count : 2908

Merge sort

Last Update:

computer science, merge sort (also commonly spelled as mergesort) is an efficient, general-purpose, and comparison-based sorting algorithm. Most implementations...

Word Count : 6747

Quicksort

Last Update:

comparison sort, meaning that it can sort items of any type for which a "less-than" relation (formally, a total order) is defined. It is a comparison-based...

Word Count : 9985

Selection sort

Last Update:

In computer science, selection sort is an in-place comparison sorting algorithm. It has an O(n2) time complexity, which makes it inefficient on large lists...

Word Count : 1650

Bucket sort

Last Update:

sort in the most-to-least significant digit flavor. Bucket sort can be implemented with comparisons and therefore can also be considered a comparison...

Word Count : 2190

Counting sort

Last Update:

subroutine in radix sort, another sorting algorithm, which can handle larger keys more efficiently. Counting sort is not a comparison sort; it uses key values...

Word Count : 1591

American flag sort

Last Update:

American flag sort are typically used to sort large objects such as strings, for which comparison is not a unit-time operation. American flag sort iterates...

Word Count : 988

Radix sort

Last Update:

In computer science, radix sort is a non-comparative sorting algorithm. It avoids comparison by creating and distributing elements into buckets according...

Word Count : 2603

Shellsort

Last Update:

Shell sort or Shell's method, is an in-place comparison sort. It can be seen as either a generalization of sorting by exchange (bubble sort) or sorting by...

Word Count : 3436

Bogosort

Last Update:

In computer science, bogosort (also known as permutation sort and stupid sort) is a sorting algorithm based on the generate and test paradigm. The function...

Word Count : 1803

Sorting network

Last Update:

perform sorting on fixed numbers of values, in which case they are called sorting networks. Sorting networks differ from general comparison sorts in that...

Word Count : 2159

Introsort

Last Update:

log n) runtime due to the heap sort. Since the three algorithms it uses are comparison sorts, it is also a comparison sort. Introsort was invented by David...

Word Count : 1080

Cocktail shaker sort

Last Update:

shaker sort, also known as bidirectional bubble sort, cocktail sort, shaker sort (which can also refer to a variant of selection sort), ripple sort, shuffle...

Word Count : 1087

Topological sorting

Last Update:

In computer science, a topological sort or topological ordering of a directed graph is a linear ordering of its vertices such that for every directed edge...

Word Count : 3176

Natural sort order

Last Update:

String Comparison in 2000. "Sorting for Humans : Natural Sort Order". blog.codinghorror.com. 12 December 2007. "PHP: natsort - Manual". php.net. "Sort::Naturally...

Word Count : 263

Decision tree model

Last Update:

show that a comparison sort of n {\displaystyle n} items must take n log ⁡ ( n ) {\displaystyle n\log(n)} comparisons. For comparison sorts, a query is...

Word Count : 3658

Heapsort

Last Update:

computer science, heapsort is a comparison-based sorting algorithm which can be thought of as "an implementation of selection sort using the right data structure...

Word Count : 5718

Stooge sort

Last Update:

MIT Press and McGraw-Hill. pp. 161–162. ISBN 0-262-03293-7. Sorting Algorithms (including Stooge sort) Stooge sort – implementation and comparison v t e...

Word Count : 483

Schwartzian transform

Last Update:

used to improve the efficiency of sorting a list of items. This idiom is appropriate for comparison-based sorting when the ordering is actually based...

Word Count : 1706

Cycle sort

Last Update:

Cycle sort is an in-place, unstable sorting algorithm, a comparison sort that is theoretically optimal in terms of the total number of writes to the original...

Word Count : 914

Polyphase merge sort

Last Update:

A polyphase merge sort is a variation of a bottom-up merge sort that sorts a list using an initial uneven distribution of sub-lists (runs), primarily used...

Word Count : 2324

Tree sort

Last Update:

worst-case performance, thus being degree-optimal for a comparison sort. However, tree sort algorithms require separate memory to be allocated for the...

Word Count : 636

Gnome sort

Last Update:

least as many comparisons as insertion sort and has the same asymptotic run time characteristics. Gnome sort works by building a sorted list one element...

Word Count : 462

Time complexity

Last Update:

{\displaystyle T(n)=o(n^{2})} . For example, simple, comparison-based sorting algorithms are quadratic (e.g. insertion sort), but more advanced algorithms can be found...

Word Count : 5004

PDF Search Engine © AllGlobal.net