Bead sort

Bead sort

Bead sort is a natural sorting algorithm, developed by Joshua J. Arulanandham, Cristian S. Calude and Michael J. Dinneen in 2002, and published in The Bulletin of the European Association for Theoretical Computer Science. Both digital and analog hardware implementations of bead sort can achieve a sorting time of "O"("n"); however, the implementation of this algorithm tends to be significantly slower in software and can only be used to sort lists of positive integers. Also, it would seem that even in the best case, the algorithm requires "O"("n2") space.

Algorithm Overview

The bead sort operation can be compared to the manner in which beads slide on parallel poles, such as on an abacus. However, each pole may have a distinct number of beads. Initially, it may be helpful to imagine the beads suspended on vertical poles. In Step 1, such an arrangement is displayed using "n=5" rows of beads on "m=4" vertical poles. The numbers to the right of each row indicate the number that the row in question represents; rows 1 and 2 are representing the positive integer 3 (because they each contain three beads) while the top row represents the positive integer 2 (as it only contains two beads).By convention, a row representing the positive integer "k" should have beads on poles 1.."k" and poles "k"+1.."m" should be empty. This is not a strict requirement, but will most likely simplify implementation.] If we then allow the beads to fall, the rows now represent the same integers in sorted order. Row 1 contains the largest number in the set, while row "n" contains the smallest. If the above-mentioned convention of rows containing a series of beads on poles 1.."k" and leaving poles "k"+1.."m" empty has been followed, it will continue to be the case here.

The action of allowing the beads to "fall" in our physical example has allowed the larger values from the higher rows to propagate to the lower rows. If the value represented by row "a" is smaller than the value contained in row "a+1", some of the beads from row "a+1" will fall into row "a"; this is certain to happen, as row "a" does not contain beads in those positions to stop the beads from row "a+1" from falling.

The mechanism underlying bead sort is similar to that behind counting sort; the number of beads on each pole corresponds to the number of elements with value equal or less than the index of that pole.

Complexity

Bead sort can be implemented with three general levels of complexity, among others:
*"O"(1): The beads are all moved simultaneously in the same time unit, as would be the case with the simple physical example above. This is an abstract complexity, and cannot be implemented in practice.
*"O"(sqrt{n}): In a realistic physical model that uses gravity, the time it takes to let the beads fall is proportional to the square root of the maximum height, which is proportional to n.
*"O"(n): The beads are moved one row at a time. This is the case used in the analog and digital hardware solutions.
*"O"(S), where S is the sum of the integers in the input set: Each bead is moved individually. This is the case when bead sort is implemented without a mechanism to assist in finding empty spaces below the beads, such as in software implementations.

Like the Pigeonhole sort, bead sort is unusual in that it can perform faster than "O"("n"log"n"), the fastest performance possible for a comparison sort. This is possible because the key for a bead sort is always a positive integer and bead sort exploits its structure.

References and notes

External links

*PDFlink| [http://www.cs.auckland.ac.nz/~jaru003/research/publications/journals/beadsort.pdf The Bead Sort paper] |114 KiB
* [http://mgs.ibisc.univ-evry.fr/ImageGallery/EXEMPLES/BeadSort/index.html Bead Sort in MGS] , a visualization of a bead sort implemented in the [http://mgs.ibisc.univ-evry.fr MGS] programming language
* [http://mathworld.wolfram.com/Bead-Sort.html Bead Sort on MathWorld]


Wikimedia Foundation. 2010.

Игры ⚽ Поможем сделать НИР

Look at other dictionaries:

  • Downstairs Sort — Infobox Software name = Downstairs Sort caption = author = http://www.nongnu.org/ developer = Andrius da Costa Ribas released = initial release|2004|11|9 frequently updated = Yes programming language = C++, XUL, XBL, JavaScript operating system …   Wikipedia

  • Merge sort — Example of merge sort sorting a list of random dots. Class Sorting algorithm Data structure Array Worst case performance O(n log n) …   Wikipedia

  • Counting sort — In computer science, counting sort is an algorithm for sorting a collection of objects according to keys that are small integers; that is, it is an integer sorting algorithm. It operates by counting the number of objects that have each distinct… …   Wikipedia

  • Comb sort — Class Sorting algorithm Data structure Array Worst case performance O(n log n)[1] …   Wikipedia

  • Cocktail sort — Class Sorting algorithm Data structure Array Worst case performance О(n²) Best case performance O(n) …   Wikipedia

  • Pigeonhole sort — Class Sorting algorithm Data structure Array Worst case performance O(N + n), where N is the range of key values and n is the input size Worst case space complexity O(N * n) …   Wikipedia

  • Cycle sort — Example of cycle sort sorting a list of random numbers. Class Sorting algorithm Data structure Array Worst case performance Θ(n2) …   Wikipedia

  • Odd–even sort — Example of odd even transposition sort sorting a list of random numbers. Class Sorting algorithm Data structure Array Worst case performance …   Wikipedia

  • Stop bead — Stop Stop, n. 1. The act of stopping, or the state of being stopped; hindrance of progress or of action; cessation; repression; interruption; check; obstruction. [1913 Webster] It is doubtful . . . whether it contributed anything to the stop of… …   The Collaborative International Dictionary of English

  • Sorting algorithm — In computer science, a sorting algorithm is an algorithm that puts elements of a list in a certain order. The most used orders are numerical order and lexicographical order. Efficient sorting is important for optimizing the use of other… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”