Factbites
 Where results make sense
About us   |   Why use us?   |   Reviews   |   PR   |   Contact us  

Topic: Stable sort


Related Topics

In the News (Mon 21 Dec 09)

  
  sort - perl pragma to control sort behaviour
A stable sort means that for records that compare equal, the original input ordering is preserved.
stability might matter because elements that compare equal on the first 3 characters may be distinguished based on subsequent characters.
But the stability of the default sort is a side-effect that could change in later versions.
cpan.uwinnipeg.ca /htdocs/perl/sort.html   (579 words)

  
 Stata help for sort
sort arranges the observations of the current data into ascending order based on the values of the variables in varlist.
The dataset is marked as being sorted by varlist unless in range is specified.
stable specifies that observations with the same values of the variables in varlist keep the same relative order in the sorted data that they had previously.
www.stata.com /help.cgi?sort   (229 words)

  
 man: sort
In Perl versions 5.6 and earlier the quicksort algorithm was used to implement "sort()", but in Perl 5.8 a mergesort algorithm was also made available, mainly to guarantee worst case O(N log N) behaviour: the worst case of quicksort is O(N**2).
Stability will matter only if elements that compare equal can be dis- tinguished in some other way.
If stability is important, be sure to say so with a use sort 'stable'; The "no sort" pragma doesn't forbid what follows, it just leaves the choice open.
www.hmug.org /man/3/sort.php   (663 words)

  
 : Class Sort   (Site not responding. Last check: 2007-11-03)
Create an array sorting object which will sort the array a or regions of that array, based on a comparator and a specific sort algorithm.
Heap sort is not stable but usually faster than merge sort and better than quicksort when the data is mostly sorted.
The merge sort is used by default because it is a stable sort.
support.sas.com /rnd/appdev/V2/webAF/api/com/sas/util/Sort.html   (529 words)

  
 UTN #9: Deterministic Sorting
A stable sort is one where two records will retain their order when sorted according to a particular field, even when the two fields have the same contents.
A stable sort is often desired; for one thing, it allows records to be successively sorting according to different fields, and retain the correct lexigraphic order.
Thus with a stable sort, one could all the records by First_Name, then sort all the records by Last_Name, giving the desired results: that all records would be sorted by Last_Name, and where the Last_Names are the same, sorted by First_Name.
www.unicode.org /notes/tn9   (1965 words)

  
 sort
use sort 'stable'; # guarantee stability use sort '_quicksort'; # use a quicksort algorithm use sort '_mergesort'; # use a mergesort algorithm use sort 'defaults'; # revert to default behavior no sort 'stable'; # stability not important use sort '_qsort'; # alias for quicksort my $current = sort::current(); # identify prevailing algorithm
"\n"; @a = sort @b; } { use sort "stable"; print sort::current.
"\n"; @a = sort @b; eval 'use sort "defaults"'; # clean up, for others } { eval 'use sort qw(defaults stable)'; # force stability print sort::current.
www.findip.biz /perl/sort.html   (570 words)

  
 Arrays (GNU Classpath 0.93 Documentation)
The array must be sorted (as by the sort() method) - if it is not, the behaviour of this method is undefined, and may be an infinite loop.
The array must be sorted (as by the sort() method with the same Comparator) - if it is not, the behaviour of this method is undefined, and may be an infinite loop.
The sort algorithm is a mergesort with the merge omitted if the last element of one half comes before the first element of the other half.
developer.classpath.org /doc/java/util/Arrays.html   (4107 words)

  
 Insertion Sort   (Site not responding. Last check: 2007-11-03)
One of the simplest methods to sort an array is an insertion sort.
To sort the cards in your hand you extract a card, shift the remaining cards, and then insert the extracted card in the correct place.
Stable sorts retain the original ordering of keys when identical keys are present in the input data.
epaperpress.com /sortsearch/ins.html   (210 words)

  
 sort : Java Glossary
The merge sort makes a clone of the array (but not the objects) before it starts, so be aware of the memory usage.
Another is the bubble sort, where you pairwise swap elements in a pass through all the elements to percolate the biggest element to the top.
A variant of the bubble sort, that is a tiny bit faster is the bi-directional sort that percolates the smallest element to the bottom and the biggest element to the top in alternating direction passes, gradually working toward the middle.
mindprod.com /jgloss/sort.html   (1683 words)

  
 WebDeveloper.com - Stable sort method
A sort is stable if, when two objects have matching keys, the sort does not change the relative positions of the objects.
This is because the stable sort does not change the relative order of the rows (=objects) when the keys match.
Non-stable sorts will still arrange the rows so that the keys are in ascending order (A,A,A,B,B,B), but, within the A-goup and separately within the B-group, the order of the second column will be mixed up.
www.webdeveloper.com /forum/printthread.php?t=48397   (258 words)

  
 UTN #???: Deterministic Collation
A stable sort is one where two records with a field that compares as equal will retain their order when sorted according to that field.
This is a property of the sorting algorithm, not the comparison mechanism.
A stable sort is to be distinguished from a deterministic sort.
www.macchiato.com /utc/stable_sort_tn.htm   (948 words)

  
 Xah: Python Doc Problem Example: sort()
A sort is stable if it guarantees not to change the relative order of elements that compare equal -- this is helpful for sorting in multiple passes (for example, sort by department, then by salary grade).
If the programer does not use the “key” syntax when sorting a large matrix (provided that he knew in advance of the list to be sorted or the ordering function), then he is penalized by a severe inefficiency by a order of magnitude of execution time.
It employs the jargon “stable sort” then proceed to explain what it is, then in trying to illustrate the situation, it throws “multiple passes” and the mysterious “by department, by salary”.
xahlee.org /perl-python/python_doc_sort.html   (1557 words)

  
 A Fresh Look at Efficient Perl Sorting
Sorting is the rearrangement of a list into an order defined by a monotonically increasing or decreasing sequence of sortkeys, where each sortkey is a single-valued function of the corresponding element of the list.
Sorting theory and algorithms usually ignore the cost of this association, as it is typically a constant factor of the comparison operation.
Consider the common problem of sorting a two-dimensional data structure, a list of references to arrays or to hashes, where the sortkeys are functions of the values of the submembers.
www.sysarch.com /perl/sort_paper.html   (4816 words)

  
 stable   (Site not responding. Last check: 2007-11-03)
A stable sort would yield Brodsky (19), Liang (19), David (21), Max (45), and Carla (45).
A sort that is not stable may put Liang before or after Brodsky and Carla before or after Max.
A radix sort requires each phase to be stable.
www.nist.gov /dads/HTML/stable.html   (245 words)

  
 Stable and Unstable sorts - A guide to sorting - Developer Fusion: Connecting Developers Worldwide. C#, .NET, VB, Java, ...
There are two kinds of sort algorithms: "stable sorts" and "unstable sorts".
Then in a stable sort, I am guaranteed that the output will be <1981, "Fred">, <1982, "Harriet">, <1983, "Harry">, <1983, "Ellen">, <1984, "Charles">, <1985, "Mary">, <1987, "Joe">.
Note that qsort is not specified as a stable sort.
www.developerfusion.co.uk /show/3824/6   (288 words)

  
 Guile Reference Manual
The first group of procedures can be used to merge two lists (which must be already sorted on their own) and produce sorted lists containing all elements of the input lists.
The sorting is destructive, that means that the input sequence is modified to produce the sorted result.
The sorting is destructive, that means that the input list is modified to produce the sorted result.
www.gnu.org /software/guile/docs/docs-1.6/guile-ref/Sorting.html   (300 words)

  
 ANSI and GNU Common Lisp Document - sort
sort determines the relationship between two elements by giving keys extracted from the elements to the predicate.
If the key and predicate always return, then the sorting operation will always terminate, producing a sequence containing the same elements as sequence (that is, the result is a permutation of sequence).
The sorting operation performed by sort is not guaranteed stable.
www.cs.queensu.ca /software_docs/gnudev/gcl-ansi/gcl_1023.html   (490 words)

  
 stable_sort
Sort a sequence of characters ignoring their case.
One standard example is sorting a sequence of names by last name: if two people have the same last name but different first names then they are equivalent but not equal.
is sometimes useful: if you are sorting a sequence of records that have several different fields then you may want to sort it by one field without completely destroying the ordering that you previously obtained from sorting it by a different field.
www.oopweb.com /CPP/Documents/STLGuide/Volume/stable_sort.html   (339 words)

  
 Python owns us
The initial implementation was fine with many aspects, but there were two annoyances, namely the fact that the new sort introduces 2*N extra bytes memory burden and that with a specific data profile timsort was significantly slower.
Tim implemented also the Edelkamp and Stiegeler's "Next-to-m" refinement of weak heapsort, but the first refinement of their algorithm proved to be so far from promising that he dropped it.
Eventually the tuning got into point where timsort for troublesome sample data was at the same level or even faster than the current sort, so the speed issue went practically away.
py-stablesort.sourceforge.net /doc/2002_07_28_pythonowns_archive.html   (850 words)

  
 sort man document
sort sorts lines of all the files together and writes the result on the standard output.
Check that the single input file is sorted according to the ordering rules; give no output unless the file is out of sort.
Sorting is done by a method determined by the -x option.
www.research.att.com /~gsf/man/man1/sort.html   (1008 words)

  
 Dr. Dobb's | Some Tips For QuickSort | April 15, 2003   (Site not responding. Last check: 2007-11-03)
Stable sorts are nice in one sense because they can be applied one after the other.
If I need to sort a file by counties for one report, and by counties within states for another report, and I use a stable sort, then I can run the first report followed by a stable sort on the states alone for the second report.
An even better way is to ignore the small subfiles during the first phase of the sort, then go back through the entire files and sort it with a procedure tuned for handling M or fewer records.
www.ddj.com /dept/cpp/184402294   (1110 words)

  
 Cocktail sort - Wikipedia, the free encyclopedia
Cocktail sort, also known as bidirectional bubble sort, cocktail shaker sort, shaker sort (which can also refer to a variant of selection sort), ripple sort, shuttle sort or happy hour sort, is a variation of bubble sort that is both a stable sorting algorithm and a comparison sort.
Cocktail sort is a slight variaton of bubble sort.
The reason for this is that bubble sort only passes through the list in one direction and therefore can only move items backward one step each iteration.
en.wikipedia.org /wiki/Cocktail_sort   (319 words)

  
 sradixsort() -- perform stable radix sort
This function sorts an array of pointers to byte strings, the initial member of which is referenced by base.
The table argument is useful for applications which wish to sort different characters equally, for example, providing a table with the same weights for A-Z as for a-z results in a case-insensitive sort.
Insufficient memory is available to create the table needed to implement the stable sort algorithm.
www.mkssoftware.com /docs/man3/sradixsort.3.asp   (288 words)

  
 Sorting Algorithms   (Site not responding. Last check: 2007-11-03)
Sort algorithms which only use an abstract key comparison operation always need at least O(n log n) comparisons on average; while sort algorithms which exploit the structure of the key space cannot sort faster than O(n log k) where k is the size of the keyspace.
This is actually a pretty important case as often sorting is actually resorting of previously sorted data done after minimal modifications of the data set.
Insertion sort and selection sort are seen to be instances of merge sort and quicksort, respectively, and sinking sort and bubble sort are in-place versions of insertion sort and selection sort.
www.softpanorama.org /Algorithms/sorting.shtml   (3521 words)

  
 bubble sort   (Site not responding. Last check: 2007-11-03)
Definition: Sort by comparing each adjacent pair of items in a list in turn, swapping the items if necessary, and repeating the pass through the list until no swaps are done.
Bidirectional bubble sort usually does better since at least one item is moved forward or backward to its place in the list with each pass.
The name "sinking sort" comes from elements sinking down to their proper position.
www.nist.gov /dads/HTML/bubblesort.html   (223 words)

  
 [No title]
A stable sort is one where two records with a field that compares as equal will retain their order if sorted according to that field.
For example, a bubble sort is stable, while a quick sort is not.
The Rmail sort commands perform a stable sort: if there is no reason to prefer either one of two messages, their order remains unchanged.
www.lycos.com /info/stable-sort.html   (323 words)

  
 python-stablesort -- an adaptive, stable, natural mergesort
This project is now pretty much obsolete, as shortly after the official Python 2.3 release the sort() method has been changed to guarantee a stable sorting behaviour.
It can also be regarded as some sort of forward-port in case the default Python list sort() method will change to a non-stable algorithm in the future again.
This sort is also stable (if A==B and A precedes B in the list at the start, A precedes B after the sort too), although the language definition does not guarantee stability.
py-stablesort.sourceforge.net   (625 words)

  
 [No title]   (Site not responding. Last check: 2007-11-03)
unspecific These procedures sort their data using heap sort, which is not a stable sorting algorithm.
unspecific These procedures sort their data using quick sort, which is not a stable sorting algorithm.
The implementation of vector merge sort provided by this SRFI's reference implementation is, additionally, a "natural" sort, meaning that it exploits existing order in the input data, providing O(n) best case.
www-static.cc.gatech.edu /~shivers/srfi/srfi-32.txt   (2455 words)

  
 [plt-scheme] stable sort   (Site not responding. Last check: 2007-11-03)
It seemed to be a wonderfully comprehensive library of sort functions (including stable sorts of lists and vectors).
I searched for "sort" in Help Desk > and got > > (sort less-than?-proc list) PROCEDURE > This is the same as mergesort (see section 21) with the arguments > reversed.
This > implementation is not stable (i.e., if two elements in the input are > ``equal,'' their relative positions in the output may be reversed).
www.cs.brown.edu /pipermail/plt-scheme/2004-November/007222.html   (200 words)

Try your search on: Qwika (all wikis)

Factbites
  About us   |   Why use us?   |   Reviews   |   Press   |   Contact us  
Copyright © 2005-2007 www.factbites.com Usage implies agreement with terms.