I decided to try implementing my terrible sorting algorithm idea. I couldn't get it to sort more than 7 numbers with a 200 MB stack size. lol
edit: I think I figured out how to fix the stack overflow problem with tail recursion. I'll update with results if it works. might take a few hours to sort all 8 numbers though.
update: it looks like it works, but sorting an 8 int array seems like it'll take a few days
void shuffle(int *unshuffled, int len){ int shuffled[len]; char mask[len]; for (int i = 0; i < len; i++) mask[i] = 0; for (int j, i = 0; i < len; i++) { do { j = rand() % len; } while(mask[j] != 0); mask[j] = 1; shuffled[j] = unshuffled[i]; } memcpy(unshuffled, shuffled, len * sizeof(int));}/*if length > 2, call crap_sort on both halves of the arrayshuffle the unsorted array aroundif not sorted, call crap_sort*/void crap_sort(int *unsorted, int len){ crap_sort_start: if (len > 2) { int left_len = len/2; crap_sort(unsorted, left_len); crap_sort(unsorted + left_len, len - left_len); } shuffle(unsorted, len); for (int i = 1; i < len; i++) { if (unsorted[i] < unsorted[i - 1]) { goto crap_sort_start; } }}