I'm doing some computer science homework and I need help. How should I ask my question here?

The existing discussions about tend to center around how to answer them and how to moderate them. It strikes me that we're short on guidance towards askers. We have

  • Reference answers to frequently asked questions — that's not guidance towards asker. It's a table of questions that are likely duplicate targets, but a thread that attempts to summarize all of computer science basics is not something to throw at a computer science student.
  • Some short comments that, once again, are more geared towards people doing moderation than towards their actual target, namely people who are doing the asking and do not know our jargon.

Please answer this question with students asking homework questions in mind.


3 Answers 3


D.W. explains what to ask. Here are some pointer towards how.

Wait, first the when:

First, talk to people, namely fellow students, TAs and teachers (in that order). Many problems go away after you talk to somebody who is thinking about the same problem, or has done so before.

If that is no option (really?) or does not work out: Google your problem. Formulating a proper web search takes practice and is an indispensible skill. So have at it. Chances are that you find your answer immediately. Maybe you find somebody with the same problem but they got answers that don't help you. Or you find something that helps you get a little farther but not all the way. In any case, you have something more to tell when asking the question.

Few things are more embarrassing (for you) and annoying (for us) than a question that can be answered by reading the Wikipedia article found by using the exact terms from a posted question.

Our reference questions can also be useful; many standard types of exercise problems are covered there. Go have a look!

Now, the how.

  1. Be precise. Not only about what the original problem is, but also about what, specifically, your issues at this point in time is.

  2. Include all necessary information. That includes problem statments, (non-standard) definitions and theorems you think you need, to the letter. Of course, stick to only necessary data.

    Keep in mind that most of your readers do not attend the same course as you. They have seen different definitions, have used different books. You need to give them what they need to understand the task, as close as you can estimate.

  3. Pick a meaningful title. If you have followed D.W.'s advice, you should be able to formulate a short question using natural language. If not, chances are you are not ready to ask yet.

    See here for some details on writing good titles.

  4. Give proper credit/references. Where does the problem come from? Where did you read this or that? Which book are you using? This is part academic ethics and courtesy, and part pragmatism: if experts know which book(s) you have they can focus their own research and tailor their answers.

    See here for advice on referencing.

  5. Imagine you are asking a professor or TA. Use this rule whenever you are unsure about any of the other points. Also, use it to inform your tone, expectations, and responses to comments you may get. Keep in mind that you are asking others to spend their time on your problem, without compensation. They are willing to help, but don't waste their time and energy.

  6. Work with feedback you are getting. Somebody posts a hint -- go try to work from there. Somebody seems to misunderstand your post -- go improve it (click "edit"). Answer questions you are getting in the comments and continue to update the question to clarify.

Finally, here's a useful reference: Eric Steven Raymond's How To Ask Questions The Smart Way.

  • 1
    $\begingroup$ +1 for goolge your problem. Also use the search engine in this site - most likely your question was already asked and answered before. $\endgroup$
    – Ran G.
    Commented May 31, 2016 at 15:07
  • 5
    $\begingroup$ @RanG. I have had more success using Google with site:cs.stackexchange.com. Their algorithm seems to be superior. $\endgroup$
    – Raphael
    Commented May 31, 2016 at 15:49
  • $\begingroup$ @Raphael The truly superior engine is the search after you enter a question title. $\endgroup$
    – Discrete lizard Mod
    Commented Feb 25, 2017 at 10:50
  • $\begingroup$ @Discretelizard Only if you pick a meaningful title, which post people don't. $\endgroup$
    – Raphael
    Commented Feb 25, 2017 at 19:16
  • 1
    $\begingroup$ @Raphael Of course, almost no search engine gives good results to bad queries (that is, unless they already know more about you than you yourself know) $\endgroup$
    – Discrete lizard Mod
    Commented Feb 25, 2017 at 21:08

Ask questions about concepts, not about your exercise

Don't ask us about how to solve your homework exercise. Instead, spend some time trying to solve the homework exercise, and use that to figure out where you have a conceptual gap in your understanding.

Then, ask about the concept you don't quite understand yet.

If you've done a good job of this, often your question won't even mention your homework exercise at all. Yes, you'll start with your exercise, and you'll try to solve it, and you'll get stuck -- but then you should use that experience to try to generalize. Perhaps you might ask about how to solve a particular type of task (e.g., how do I prove a language is regular? how do I check whether an algorithm is correct?).

Make your question useful to others

A significant part of our mission is to build an archive of high-quality questions and answers that are likely to be helpful to others. Asking how to solve your specific homework exercise is unlikely to be useful to others (as they're unlikely to have the exact same exercise as you, or to be stuck at exactly the same point).

However, if you can ask a conceptual question that gets at a theme or type of task or conceptual confusion that many people studying the same material are likely to have, then it's more likely that your question will be useful to others.

But why can't I just post my homework exercise and ask for help?

The purpose of homework exercises are (1) to give you practice, and (2) to help you self-diagnose gaps in your understanding. Therefore, asking us to solve your homework question is almost never a good idea -- it doesn't serve either of those purposes, and is likely to waste your time and ours.

We're not a homework help site. Instead, we're here to get specific conceptual computer science questions answered, and to build an archive of knowledge. Make sure your question fits that purpose.

That said, if you can't figure out how to turn your problem into a broader conceptual question and want to ask about your exercise, here is the formula for what you must do:

  1. Try to solve it before asking here. Spend a significant amount of time trying to solve it on your own, before posting here. Think hard for several hours. Try simplified versions of the problem to see if you can solve them. Try searching for similar problems here to see what you can learn from them. Don't post here until you've exhausted all available options.

  2. Show your work so far. Tell us in the question what approaches you've tried and where you got stuck. Show us what progress you've made so far. Are you asking an algorithms question? Tell us what algorithm design paradigms you've tried (e.g., greedy, dynamic programming, divide-and-conquer, etc.), and where you got stuck with each one. Show us the best algorithm you were able to find so far, even if it's less efficient than you're looking for. This helps us write answers that are more likely to be useful to you, and helps us avoid wasting time trying something you already tried.

  3. Ask about the specific concept that gives you trouble. We expect you to do the work of narrowing down the problem to the particular concept that's giving you trouble, and ask about that specifically. Don't just post your exercise and force us to infer what concept you're struggling with; you should do that part of the work, and then ask a question about the concept you're unclear on. This will yield a question that's more likely to be useful to others in the future. As a side effect, it shows that you're not just trying to get us to do your work for you.

  4. Ask about a specific aspect of the problem that you're struggling with. If you can't figure out how to identify a concept that you're unclear on, articulate a specific question about some specific aspect of the exercise. For example:

    • BAD: "Here's my exercise, how do I solve it?"

    • GOOD: "I came up with the following algorithm and it seems to work on all examples of size $\le 5$, but I'm not sure how to prove it correct -- what are some techniques for that?"

    • BAD: "Here's my exercise, I just want a hint. Can anyone give me a hint?"

    • GOOD: "I came up with an algorithm for the exercise, but my instructor requires me to prove it terminates. What are some techniques for proving that an algorithm will terminate?"

    • GOOD: "I wrote a candidate proof of correctness. However, I'm not sure whether step 5 is valid: if $p$ is a shortest path from $s$ to $t$, can I assume that it doesn't contain any cycles?"

  5. Credit the source. Reference the source of the exercise. If it's an exercise from a textbook, include the title and author of the book and the problem number, so that someone trying to answer the question can go look it up themselves if htey need to.

But my exercise isn't homework!

Actually, we don't care whether the exercise was assigned to you as homework or not. We may sometimes call your problem a "homework problem", but that is a shortcut. This policy applies whenever you ask an exercise-style problem (one designed to help you learn the material), regardless of whether it is part of a course or not, or whether it was assigned as homework, or if you're just trying it on your own.

Why won't you just show me the answer to the exercise? It's probably easy for you!

As explained on Math.SE:

Providing an answer that doesn't help a student learn is not in the student's own best interest, and if a solution complete enough to be copied verbatim and handed in is given immediately, it will encourage more people to use the site as a free homework service.

Or, as the adage says: "give a man a fish and you feed him for a day; teach a man to fish and you feed him for a lifetime". Giving someone the answer to their exercise is giving them a fish; it might seem helpful on first glance, but in the long run, it won't help them to understand the material or get better at solving similar problems. Many of us would prefer to focus on questions that will "feed you for a lifetime", e.g., by answering conceptual questions that will be useful beyond this one specific exercise.

Also, some or many of the experts here aren't very interested in devoting their energy towards a site whose primary purpose is to help with homework. If we answered homework questions, we'd risk being swamped by homework questions, and then some or many of the experts might leave, leading to a downward spiral for the site. We want to avoid that. Don't take it personally.

In general, as articulated on CS Theory, we want questions here to be inspired based on the spirit of knowledge sharing, not shirking. As they say there:

You should only post questions you're actually seriously thinking about. Users are expected to do their part and try to answer their question by themselves before posting them on cstheory and asking for help from others. Search to see if your question is already answered somewhere else (e.g. Wikipedia) before asking a question. Try to make your question interesting for others by providing some background knowledge. Remember, questions should be based on knowledge sharing, not on shirking. Shirking goes against the spirit of the site.

You might also enjoy reading the Open letter to students with homework problems on Programmers.SE.

  • 1
    $\begingroup$ Addendum: if your post contains a sentence similar to "I don't even know how to start", don't post. Review your class material instead. $\endgroup$
    – Raphael
    Commented May 29, 2016 at 11:04
  • $\begingroup$ "Show your work so far" might equal "academic dishonesty" if another classmate (who also happens to be on SE) turns in your "work so far". $\endgroup$ Commented Jun 2, 2016 at 6:06
  • 3
    $\begingroup$ @TomvanderZanden, Sure, that's possible. Did you just want to raise a warning for students who might be reading this, or was there more? If the class policy prohibits sharing solutions in a place where another student might see them, then the natural implication is that students in that class shouldn't be posting a question here about how to solve their homework. $\endgroup$
    – D.W. Mod
    Commented Jun 2, 2016 at 6:10
  • $\begingroup$ It would be bad if our guidelines suggested to students to do something unethical. A warning might be in-order, though it is an edge case (I could imagine a scenario where asking certain questions is OK, but sharing (partial) solutions is not). $\endgroup$ Commented Jun 2, 2016 at 13:41
  • 1
    $\begingroup$ @TomvanderZanden I agree; we should have an answer explaining how to use internet resources in accordance to academic and administrative rules. Can you write one? $\endgroup$
    – Raphael
    Commented Jun 3, 2016 at 23:04
  • $\begingroup$ @TomvanderZanden Something like this? $\endgroup$
    – Raphael
    Commented Sep 1, 2016 at 22:49

A word of warning

If what you are working on has been assigned to you for homework, asking about it on the internet may defeat the purpose of the exercise.

If your teachers know what they are doing¹, assigned exercises will encourage you to

  1. review the requisite material,
  2. work with the definitions and theorems²,
  3. connect different concepts,
  4. (occasionally) have new ideas, thus deepening your understanding, and
  5. communicate your thoughts using shared, technical terminology and notation.

Think of it like you think of football practice: you have to kick the ball thousands of times before you can reliably hit the goal in a match and in a variety of circumstances. Similarly, you have to perform, say, proofs by induction a couple of dozen times (at least) before you get really good at it and start to see patterns.

If you outsource significant parts of the exercise-solving process, you rob yourself of a learning opportunity. It is the process that counts, not whether you get a 100% correct answer on the end (even though that would be nice).

What is "significant"? Depends. There are no clear-cut rules. It's probably okay, both in the sense above and that below, if you ask about one step in a two-page proof. It's certainly not okay to just post the whole exercise. Use your best judgement.

Interlude: I am fully aware that typical systems of the form "you have to earn X% of the points to pass or be allowed to take the final exam" mask what I write above, and create external motivation to get that perfect answer on paper in any way possible. That sucks. Remember that you chose to study CS; please take responsibility of your own learning process, and that includes realizing that you have to do the work yourself³. 10000 hours to mastery -- look it up.

Now, teachers and schools know all this and may take measures that are as clumsy as they are desparate, all to make you learn: they write up regulations that forbid getting outside help on your homework. That would include asking a question here. Violating such rules may get you failing grades in a course, or even expelled from your school. Check the statutes of your school, department, and course.

Final warning: Once you post a question and get answers, the material is considered property of the community, as per the terms of use of Stack Exchange. If you delete your question without good reason (erasing traces of you cheating is not one, for example) we will undelete it. We can not know what is allowed where, so we do not discriminate when answering -- but also not when wanting to keep good content. So think before you post.

  1. Please accept that you are probably not in the position to judge if they are.
  2. I'm using TCS lingo here because, frankly, most homework questions we get are from there. It's similar in other areas, though.
  3. I'm all for working in groups, by the way -- if everyone thinks along and contributes.

You must log in to answer this question.

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