https://github.com/glesica/shotgun-sort
ANSI C Implementation of Shotgun Sort
https://github.com/glesica/shotgun-sort
c sorting sorting-algorithms stupid
Last synced: over 1 year ago
JSON representation
ANSI C Implementation of Shotgun Sort
- Host: GitHub
- URL: https://github.com/glesica/shotgun-sort
- Owner: glesica
- Created: 2012-04-08T03:44:27.000Z (over 14 years ago)
- Default Branch: master
- Last Pushed: 2017-09-27T06:58:58.000Z (almost 9 years ago)
- Last Synced: 2025-04-01T12:53:06.531Z (over 1 year ago)
- Topics: c, sorting, sorting-algorithms, stupid
- Language: C
- Homepage:
- Size: 3.91 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README
Awesome Lists containing this project
README
An ANSI C implementation of Shotgun Sort. The general algorithm works as such:
SGSORT(list):
while list is not sorted:
randomize list
Note: This should be obvious, but in case it isn't, don't actually use this
algorithm for real work. It's time complexity is unbounded and it may never
terminate.
Note 2: I didn't think very hard about the randomize() function, it may
not produce orderings in a uniformly distributed manner. But really who
cares, as long as all orderings are possible.