O(1) sorting algorithm. http://pastebin.com/LP5sxLyx
#include
#include
/**
* ConwaySort:
* sorts an array by ignoring it and then
* printing out a new, sorted array with its
* own “Alternative Values.”
*
* If the new array does not appear sorted,
* you have been manipulated by MSM
*/
// The array to be sorted
int arr[] = {6, 8, 3, 9, 5, 4, 1, 7, 0, 2};
int main(int argc, char **argv) {
printf (“15, 16, 17, 18, 19, 20n”);
return 0;
}
BTCT
LikeLike
Beth Tfiloh Community Theatre?
LikeLike
Beyond The Caution Tape?
LikeLike
Bleeding Time Clotting Time?
LikeLike
Been There Coded That.
(Argh.)
LikeLike
That’s not only O(n), that’s even O(1).
LikeLike
The O(0) approach is just to ignore the problem.
LikeLike
Andres Soolo yes, you’re right. Corrected.
LikeLike
John Hardy not a Turnbull fan: It’s not widely understood, but the Big O is normally explicitly defined as the upper bound, so it’s not incorrect to use a more lenient asymptotic bound.
It’s the Big Theta that bounds both sides.
LikeLike
I must have been away the year they did that class.
LikeLike
John Hardy not a Turnbull fan I studied Old English language and literature (up to 1100 CE), so I get to post any sh*t I want about computers without worried whether it’s correct. It’s sort of like being president of a major OECD country.
LikeLike
John Hardy not a Turnbull fan for a Conway sort, you need to print out a less logical sequence. Your one has no gaping holes in it.
LikeLike