Problem Solving Tips

When you ask for help on a problem, please be prepared to describe which step in the sequence of tips you are having trouble with (e.g., "B2") and your answers to the previous steps (particularly within the same section-A or B or C).

A. Getting Started

Don't know how to get started? Describe the problem in detail:
  1. What are the goals of the problem?
  2. What are the inputs?
  3. What are the outputs?
  4. What is their relationship?
  5. Can you solve a small example by hand?
  6. Is there a part of the problem you could write code for? (and worry about the rest later?)
  7. Can you describe the algorithm in words (pseudocode)?

B. Compiling Code

Is the compiler complaining of a syntax error?
  1. What line is the syntax error on?
  2. What does the text of the error mean?
  3. What are your hypotheses about the specific cause of the error?

C. Getting Code to Work

Is your code not behaving the way you expect?
  1. What evidence do you have that the code doesn t work?
  2. What test case doesn t work and what incorrect behavior or output results?
  3. Could you come up with a simpler example that demonstrates the error?
  4. What lines of code might be producing the bug?
  5. Why hypotheses do you have for what might be causing the problem?
  6. How can you test these hypotheses? (e.g. writing new test cases, adding print statements, using a debugger)
  7. Could you walk through an example that doesn t work: by hand? with a debugger?

Acknowledgments

This list of tips originated as "Tips for Tutors" at http://wiki.cs.grinnell.edu/foswiki/bin/view/Main/TipsForTutors. It was adapted by CS Teaching Tips (https://www.csteachingtips.org/tips-tutors) and later for individual students by Jim Williams of UW Madison.