Re:Trolling homework questions - sorting
by codezero on Friday December 27, 2013 @08:57PM
(#6973521)
Trolling people looking for easy answers is pointless. Folks like this won't use a single source to send in their work. The problem with this approach is you often penalize people who are truly curious and not trolls.
If you were to allow the masses to determine whether a question is a troll question or not, using an OR, allowing anyone to flip the bit, then almost every question would be considered a troll question. You get a lot of false positives.
Providing a thorough, quality answer to a troll question won't help advance that troll's career, they will pay the price later, for sure, when their intellect is on the line.
Providing a trolly answer, and treating the question asker as insincere will inevitably treat a sincere person like shit, and turn them off entirely from entire genres and disciplines.
Treat resources as sincere, and those who wish to abuse them for temporary short term gain will, and I am very confident about this, end up fucking themselves over.
*If you downvote this, please let me know what you disagree with, I'm open to debate.
Re:Trolling homework questions - sorting
by nilkn on Friday December 27, 2013 @11:16PM
(#6973907)
In terms of responding seriously to someone actually asking for code to sort a list, I completely agree with you. My impression, though, since this is on the Code Golf section of Stack Exchange, is that this is purely hypothetical. It's a challenge to come up with the most evil answer to the question, not as a serious answer to someone asking it but as a puzzle.
Re:Trolling homework questions - sorting
by yeukhon on Friday December 27, 2013 @09:10PM
(#6973546)
I didn't downvote you. Two thoughts:
1. I read the whole thing three times and I still don't really understand what your objective is.... and do you actually know the purpose of the trolling thread or not. The purpose is to have fun and pretend one as a student who is under some stress and is trying to figure out some funny yet creative ways to brain fuck with the TA or professor. Even if it receives F, whatever.
> Treat resources as sincere, and those who wish to abuse them for temporary short term gain will, and I am very confident about this, end up fucking themselves over.
Well, most of the questions we ask on the Internet are really for short-term gain anyway. We hope someone could tell us why the fuck the X.so file is not linked and we move on afterward.
Most of the answers are actually not some quick jerky answers. people actually took time to write them. And in the process of writing an answer, the author learns. Ever heard of "one teaches, two learns?"
2. Why so serious? The Internet is full of shit half of the time. Wasting 100MB in the database for 100 trolling answers isn't going to kill some hungry child in Africa.
Re:Trolling homework questions - sorting
by pandaman on Saturday December 28, 2013 @12:00AM
(#6974014)
>Providing a thorough, quality answer to a troll question won't help advance that troll's career, they will pay the price later, for sure, when their intellect is on the line.
This what would happen in an ideal world.
In reality though it's orders of magnitude easier to check credentials than intellect (provided it's even possible to do the later). In many situations, if you go against somebody with credentials without credentials of your own you won't even have a chance to have a battle of wits (like applying for a job that requires a degree).
And cheating will get you credentials most of the time, it's not like universities check every graduate's intellect before issuing them a diploma. Otherwise cheating would not be such a big deal in the academia.
So yes, helping stupid people with their homework will advance their career. Might not to the level of Google's CTO but to the level of the guy who codes healthcare.gov or the DV's "random number generator" or Toyota's ECU or any other example of crappy code that has a good chance to interfere with people's lives. Please don't do that. If you don't want to troll them - just don't reply.
Re:Trolling homework questions - sorting
by DanBC on Saturday December 28, 2013 @04:27AM
(#6974518)
Everything you say is true. Luckily, none of it applies because no one goes to CodeGolf for homework questions.
CodeGolf will look at other SE sites, find homework questions, then take those questions back to codegolf.
Thus, CodeGolf gets an interesting new flavour of challenge (provide the worst solution to a problem) and the person who originally asked the question doesn't have to deal with the codegolfing. They do, however, have to deal with the rest of SE.
I guess downvotes are because you appear to think that codegolfers are answering in the threads where the questions are originally asked.
Re:Trolling homework questions - sorting
by codezero on Saturday December 28, 2013 @12:47PM
(#6975541)
Makes sense. But for folks who are downvoted it can be helpful to know some context, I've noticed that when you ask for feedback you get it and when you don't you end up confused and a bit pissed which is toxic over time.
I was -1 when I edited the comment to include it and +22 now and a lot less confused.
Re:Trolling homework questions - sorting
by ChuckMcM on Saturday December 28, 2013 @03:13PM
(#6976269)
No reason on the divide. Just because. That is probably a reasonable guess on the big O value. Clearly O(rand) is cheeky but in accurate. And the PRNG will walk the number space so it will eventually succeed, but computing how long it will take for 'n' numbers eludes my math reasoning skills.
Re:Trolling homework questions - sorting
by emilv on Sunday December 29, 2013 @02:11AM
(#6978745)
> the PRNG will walk the number space
Are you sure? What if there's an infinite amount of tries to get to a certain number? You can of course reason about the average case, but maybe the worst case (when there's an input number which is never found by the PRNG) does never halt.
> O(rand)
For sorting algorithms we usually compare in the number of input elements. You can reason about the average case where the numbers are found in average time so you can consider the number of iterations to find the correct number a constant (a very large constant but a constant nonetheless).
Re:Trolling homework questions - sorting
by nitrogen on Sunday December 29, 2013 @01:23AM
(#6978646)
Is that the case for all platforms and C libraries? Also, isn't seeding with the current time a way to guarantee deterministic behavior? An attacker of such an algorithm probably knows what time it is, and users probably don't expect all invocations within a given second to return the same results.
Re:Trolling homework questions - sorting
by mihai_ionic on Friday December 27, 2013 @08:37PM
(#6973475)
And it even has the best time bound you can get for a comparison based sort. Most OS schedulers would use a heap/priority queue internally for timers, which makes sleep sort O(n log n).
Re:Trolling homework questions - sorting
by gizmo686 on Friday December 27, 2013 @09:26PM
(#6973580)
wouldn't sleep sort be O(k), where k is the largest element to be sorted? (Assuming the clock and scheduler are precise enough to achieve the correct answer the first attempt).
Re:Trolling homework questions - sorting
by lmm on Saturday December 28, 2013 @12:10PM
(#6975408)
I've looked quite hard for obfuscated Python (and there are a couple of other answers to this question using it). It's always been much more readable than that perl.
Re:Trolling homework questions - sorting
by Houshalter on Saturday December 28, 2013 @01:07AM
(#6974155)
I considered considering this ridiculously over-complicated approximate solution. Train a neural network to sort with a bunch of examples of sorted arrays.
Re:Trolling homework questions - sorting
by Houshalter on Saturday December 28, 2013 @05:25AM
(#6974633)
You would have to deal with a maximum size limit, or sort only sections of it at a time.
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
by ultimatedelman on Friday December 27, 2013 @07:21PM
(#6973279)
This is brilliant because it encourages thinking a little differently to come up with the wrong answer (which helps you learn to identify wrong code). Nice work OP
Re:Trolling homework questions - sorting
by yeukhon on Friday December 27, 2013 @08:26PM
(#6973451)
The 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!
Re:Trolling homework questions - sorting
by cromulent on Saturday December 28, 2013 @07:29AM
(#6974855)
That was my first thought - use a call to the MT api to get the sort done, and then "wait for response". Meets the requirements of the competition perfectly.
Re:Trolling homework questions - sorting
by Gwen_Bell on Friday December 27, 2013 @08:39PM
(#6973481)
This reminds me of learning Git. It was hard. Probably the hardest thing I've ever learned. But it was worth it, because I Did The Work, and now I'm a hacker.
If you were to allow the masses to determine whether a question is a troll question or not, using an OR, allowing anyone to flip the bit, then almost every question would be considered a troll question. You get a lot of false positives.
Providing a thorough, quality answer to a troll question won't help advance that troll's career, they will pay the price later, for sure, when their intellect is on the line.
Providing a trolly answer, and treating the question asker as insincere will inevitably treat a sincere person like shit, and turn them off entirely from entire genres and disciplines.
Treat resources as sincere, and those who wish to abuse them for temporary short term gain will, and I am very confident about this, end up fucking themselves over.
*If you downvote this, please let me know what you disagree with, I'm open to debate.
1. I read the whole thing three times and I still don't really understand what your objective is.... and do you actually know the purpose of the trolling thread or not. The purpose is to have fun and pretend one as a student who is under some stress and is trying to figure out some funny yet creative ways to brain fuck with the TA or professor. Even if it receives F, whatever.
> Treat resources as sincere, and those who wish to abuse them for temporary short term gain will, and I am very confident about this, end up fucking themselves over.
Well, most of the questions we ask on the Internet are really for short-term gain anyway. We hope someone could tell us why the fuck the X.so file is not linked and we move on afterward.
Most of the answers are actually not some quick jerky answers. people actually took time to write them. And in the process of writing an answer, the author learns. Ever heard of "one teaches, two learns?"
2. Why so serious? The Internet is full of shit half of the time. Wasting 100MB in the database for 100 trolling answers isn't going to kill some hungry child in Africa.
This what would happen in an ideal world.
In reality though it's orders of magnitude easier to check credentials than intellect (provided it's even possible to do the later). In many situations, if you go against somebody with credentials without credentials of your own you won't even have a chance to have a battle of wits (like applying for a job that requires a degree).
And cheating will get you credentials most of the time, it's not like universities check every graduate's intellect before issuing them a diploma. Otherwise cheating would not be such a big deal in the academia.
So yes, helping stupid people with their homework will advance their career. Might not to the level of Google's CTO but to the level of the guy who codes healthcare.gov or the DV's "random number generator" or Toyota's ECU or any other example of crappy code that has a good chance to interfere with people's lives. Please don't do that. If you don't want to troll them - just don't reply.
CodeGolf will look at other SE sites, find homework questions, then take those questions back to codegolf.
Thus, CodeGolf gets an interesting new flavour of challenge (provide the worst solution to a problem) and the person who originally asked the question doesn't have to deal with the codegolfing. They do, however, have to deal with the rest of SE.
I guess downvotes are because you appear to think that codegolfers are answering in the threads where the questions are originally asked.
I was -1 when I edited the comment to include it and +22 now and a lot less confused.
Out of curiosity, why do you divide the rand() by 100 before applying the mod?
Are you sure? What if there's an infinite amount of tries to get to a certain number? You can of course reason about the average case, but maybe the worst case (when there's an input number which is never found by the PRNG) does never halt.
> O(rand)
For sorting algorithms we usually compare in the number of input elements. You can reason about the average case where the numbers are found in average time so you can consider the number of iterations to find the correct number a constant (a very large constant but a constant nonetheless).
http://codegolf.stackexchange.com/a/16390/11612
http://codegolf.stackexchange.com/a/16274
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.
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.
Or just ask wolframalpha.
https://gist.github.com/anonymous/8158332
Basically, each thread sleeps for the time corresponding to the number
Epic. Epic I say.