I considered considering this ridiculously over-complicated approximate solution. Train a neural network to sort with a bunch of examples of sorted arrays.
Trolling homework questions - sorting
31–40 of 51 posts
Re: Trolling homework questions - sorting
#32No one suggested sleep sort? That's the ultimate trolling-but-almost-legitimate sorting algorithm. :)
Re: Trolling homework questions - sorting
#33Wow. http://codegolf.stackexchange.com/a/16274
yeah, that's why i don't code in perl
perl -e 'my $vals = ".003, .002, .005"; my @sorted = sort { $a > $b } map { $_ =~ s/ +//g; $_ } split(",",$vals); print "$_ " foreach @sorted;'
You can alias the topic variable ($_) if you're not a fan.
Re: Trolling homework questions - sorting
#34I considered considering this ridiculously over-complicated approximate solution. Train a neural network to sort with a bunch of examples of sorted arrays.
I would be interested if you could expand on how you would alter the NN architecture for different sized lists
I mean it might technically be possible if you did some kind of recurrent neural network and gave the inputs through time rather than through space. And you would also have to let it interact with some kind of external memory or workspace.
Perhaps you could train it to just perform operations on the list itself (compare two elements, swap two elements, etc.) That would be the simplest way.
Re: Trolling homework questions - sorting
#35No one suggested sleep sort? That's the ultimate trolling-but-almost-legitimate sorting algorithm. :)
Re: Trolling homework questions - sorting
#36https://gist.github.com/anonymous/8158332
Basically, each thread sleeps for the time corresponding to the number
Re: Trolling homework questions - sorting
#37Re: Trolling homework questions - sorting
#38My favourite way goes like this https://gist.github.com/anonymous/8158332 Basically, each thread sleeps for the time corresponding to the number
Re: Trolling homework questions - sorting
#39The ultimate answer is to ask your young siblings to sort them for you. The price is a little time and some candy. Or since so many people are unemployed, ask them to crowdsource and work for something in return! Or just ask wolframalpha.
Set up a job through the Amazon mechanical Turk API and that might actually be possible to do programmatically.
Re: Trolling homework questions - sorting
#40Sigh, don't have an SO account but if I did, I would suggest this code which I call randsort -- #include #include #include int main(int argc, char *argv[]) { int i, ndx; double my_numbers[10]; double sorted_numbers[10]; uint16_t picked; for (i = 1; i = 0; i--) { if (( i == -1) || (sorted_numbers[i] > sorted_numbers[i+1])) { break; } } if (i == -1) { printf(" Sorted: \n"); for (i = 0; i