Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 158 Stack Exchange communities.

What is meta?
Here's how it works:
  1. Any Stack Exchange user can ask a question
  2. The community provides support, votes on ideas, and reports bugs
  3. Your voice helps shape the way Stack Exchange operates

This algorithm question: sum of all contiguous sub-array’s max difference was closed as not a real question, when there are 3 different answers, each with the same interpretation, posted. Note: I am not the asker of the question! (I have posted an answer).

I really fail to understand what is unclear regarding this question. It is an algorithm question, and it is quite clear what OP is looking for: A better than quadratic algorithm for a well defined problem. So prior code is actually irrelevant, as OP is looking for a better algorithm.

It might sound like homework, and perhaps some details regarding the motivation are missing, but does that justify closing it as a not-a-real question?

share|improve this question
I think a better question is "What qualifies an algorithm question for Stack Overflow?" Browsing around, most algorithm questions seem to follow two patterns: a) I have an algorithm and want to know if there's a better way to do it or b) I don't have an algorithm and want one. Neither of those sound incredibly constructive, but what exactly is a good algorithm question if those are not? After all, "a software algorithm" is specifically mentioned in the site's FAQ, and it's fairly broad at that. – animuson Mar 17 '13 at 17:07
@animuson: Yeah, I am getting the feeling that I am going to be annoyed quite frequently here :-). Just a few days, and I have seen so many closures of interesting problems. (I mainly frequent the algorithms tag) – Knoothe Mar 17 '13 at 17:11

It is completely immaterial whether this is homework or not. This, in all likelihood, got closed as "not a real question" because it's not.

After stating the constraints the questioner wrote "I have an O(n2) algorithm. If anyone can suggest better than this ?". That's it.

I would have downvoted this as not showing enough research effort, commented to ask the OP if they can display their code that they have done so far (to stop other people from wasting their time and posting the same) and voted to close. I'd have voted to close because it's impossible to improve on, or correct, an algorithm that exists only on the OPs computer/in the OPs head.

share|improve this answer
Better than O(n^2), means something sub-quadratic like O(n log n) or O(n) (especially if the algorithm tag is here), doesn't it? Seeing OP's algorithm is irrelevant, apart from perhaps getting some ideas on how to attack the problem. Are pure algorithm problems not on-topic? Why even have the algorithms tag then? btw, this is most likely a programming contest question... – Knoothe Mar 17 '13 at 17:03
It's not irrelevant Knoothe. It's the difference between "do my work for me" and "I've got a problem, please help". Either of those phrases would be edited out, they're useless. Code or psuedo-code is part of how we communicate. Typing a formulae does not a question make. – ben is uǝq backwards Mar 17 '13 at 17:05
So the question closure is based on the perceived motivation? The reason OP's prior work is irrelevant (and a waste of time for answerers), is that the improvements she is expecting are algorithmic, not code based. – Knoothe Mar 17 '13 at 17:08
If it's a programming contest question then the motivation is no longer perceived @Knoothe. Whether it is or not then the comments underneath that question tell you exactly what I am. However pure someone's motivation it pays to be polite in social situations. Not being polite has consequences. If the OP had made some effort to do more than copy and paste I'm sure their question would have gone down better. As it stands about 8% of the users who saw that question voted to close. No one has yet voted to re-open. – ben is uǝq backwards Mar 17 '13 at 17:13
I could easily be talking crap here but if the OP isn't willing to help themselves I'm not sure what other, eventual, result you expect? – ben is uǝq backwards Mar 17 '13 at 17:13
Yes, I never said it was a programming contest question (and my asking this meta-question in not based on that assumption). Why do people conflate OP's motivations with whether the question is on-topic or not? OP will disappear, but the interesting question can remain on SO. Why are we judging the content based on the person (and/or motivations), rather than the content itself? In this case, the question is quite clear despite the missing fact/reference/motivation. – Knoothe Mar 17 '13 at 17:20
btw, thank you for having this discussion with me. – Knoothe Mar 17 '13 at 17:21
Yes, I would partially judge it on the motivations of the OP @Knoothe and the question wasn't closed as off-topic. Part of what you have to keep in mind is that SO gets deluged with questions each day. Lots of people spend a lot of time trying to keep the site clean; when someone comes along who doesn't particularly seem to care, then it's just another question. There's millions more where that came from. At the end of the day it's people who have to do everything here. I've argued your way before but it can get frustrating eventually - and no problem :-) feel free to ignore me. – ben is uǝq backwards Mar 17 '13 at 17:29
I see. In this case, actually the concise question (and a mention of an O(n^2) algorithm) does help save the answerer's time :-). An O(n^2) algorithm is not trivial and does require some real thought, so OP did do some real work. Not showing that algorithm actually saves the answerer (at least me) some time, as that is most likely irrelevant for getting a sub-quadratic algorithm. I can understand the battle against poor questions, and perhaps this is just a case of collateral damage... I guess if OP is interested enough, they can edit the question and get it reopened. But... – Knoothe Mar 17 '13 at 17:36
... what I don't like is that we are preventing possible answers, hoping that the OP(who might not care) will add some information which is most likely irrelevant. – Knoothe Mar 17 '13 at 17:37

as the comments to the question said:

A copy-paste of your homework assignment doesn't qualify as a real SO question.

So, not only did the question not have an application tied with it, but the asker had already found a solution and were looking for "better"

generally "is there a better way to ..." questions also get closed as "not constructive"

share|improve this answer
I am not the asker, and OP clarified it is not homework. Getting an O(n^2) algorithm is not trivial, so OP has done some work, and just not elaborated on it. – Knoothe Mar 17 '13 at 16:54
I get >200K results seaeching for is "better way". Are you really suggesting those questions ought to be closed? And really, is asking for a more efficient algorithm not constructive? How? – Knoothe Mar 17 '13 at 16:56
@Knoothe As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or specific expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, see the FAQ for guidance. – Sam I am Mar 17 '13 at 16:59
Can you please elaborate on what kind on an edit will help you reopen the question? – Knoothe Mar 17 '13 at 17:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .