Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Pigeonhole sort
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
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!
==Example== Suppose one were sorting these value pairs by their first element: * (5, "hello") * (3, "pie") * (8, "apple") * (5, "king") For each value between 3 and 8 we set up a pigeonhole, then move each element to its pigeonhole: * 3: (3, "pie") * 4: * 5: (5, "hello"), (5, "king") * 6: * 7: * 8: (8, "apple") The pigeonhole array is then iterated over in order, and the elements are moved back to the original list. The difference between pigeonhole sort and counting sort is that in counting sort, the auxiliary array does not contain lists of input elements, only counts: * 3: 1 * 4: 0 * 5: 2 * 6: 0 * 7: 0 * 8: 1 For arrays where ''N'' is much larger than ''n'', [[bucket sort]] is a generalization that is more efficient in space and time.
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
Pigeonhole sort
(section)
Add topic