Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Bead sort
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Algorithm overview== [[File:BeadSort-Figure1.svg|thumb|right|Step 1: Suspended beads on vertical poles.]] [[File:BeadSort-Figure2.svg|thumb|right|Step 2: The beads have been allowed to fall.]] 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).<ref name="rowconventions" group=notes>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.</ref> 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 greater than the index of that pole.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)