600.106 Pre-programming (Algorithmic Thinking)
Intersession 2007

Basic Strategy for Algorithmic Problem Solving

Jorge Vasconcelos

This document presents some guidelines to approach the solution of a great variety of problems, particularly those presented in computer programming.

The strategy consists of five big steps:

  1. Read and comprehend the problem statement.
  2. Select theoretical concepts that may be applied.
  3. Qualitative description of the problem.
  4. Formalization of a solution strategy.
  5. Test and description of the solution.
Each step has attached a questionnaire, which contain questions that will lead you toward the solution of the problem or, if needed, to step back and review your work.


This document is based on the paper: Cabral, Luis G. et al. "Solucion de Problemas". Contactos Vol II, No. 8. Oct-Dic 1985. pp.42-51. UAM-I, ciencias basicas e ingenieria, Mexico.

General Problem Solving Strategy


Guiding-questionnaires to be used with the General Strategy for algorithm creation

Guide 1
  1. Do you understand every word used within the problem statement?
  2. What computational elements are relevant to the problem?
  3. What non-computational elements are relevant to the problem: Mathematics, Physics, Geography, etc.
  4. Use your own words to describe the problem. If needed, make a drawing depicting the situation stating clearly relevant objects and times.
  5. Have you solved any similar problem? If so, take advantage of that experience and its information.
  6. What data or resources are provided within the statement?
  7. What data or results are requested within the statement?
  8. Check answers 6 and 7 and decide if they are consistent with your answers 2 and 3.

Guide 2

  1. Identify all theoretical (and empirical) concepts related with the problem.
  2. Select a structure able to simplify data handling: arrays, records, files, local variables, global variables, linked lists, etc.
  3. Identify the kind of problem(s) according with its (their) structure: sequential, selection, iterative.
  4. Identify available algorithmic elements and select: what you need: well-defined instructions, already known algorithms, etc.
  5. Is it possible to simplify the problem by dividing it into simpler cases and selecting a different approach for each one? Is it possible eliminate redundant or unnecessary data?

Guide 3

  1. Do you know any hand-written way to solve the problem? If so, propose several examples and solve them "by hand", then attempt to create a generalization. In order to do that, carefully think on each step performed and watch what actions are common to every example.
  2. Make a list of variable elements, specifying their magnitude and measurement units. Associate them proper symbols or names but take care of avoid their repetition
  3. Which principles or relationships apply to the problem?
  4. Write down the selected relationships but using your own variables (symbols or names). If needed, describe equations with words.
  5. Are all variables in use? Are there as many relationships as unknown variables?
  6. Are you using all the information available in the problem statement? If not, select just the important.

Guide 4

  1. Describe your solution qualitatively (you can start by making a narration.)
  2. Make some predictions regarding the expected result based only upon the description you made. Do not assume anything that is not in your description.
  3. Make the required relationships and check that the result comes from the selected variables. (Keep in mind the measurement units.)
  4. Substitute values (with their corresponding signs and units) at the end of your development of relationships.
  5. Transform your description into an algorithm (pseudocode or flowchart). Remember, the algorithm must ask unknown values, show main results and store (in variables) the results of relationships and formulas.

Guide 5

  1. Manually compute the result (i.e. perform a hand-trace.) If needed, draw plots that describe the behavior of the variables.
  2. Follow strictly each step of the algorithm and look at the results. (Someone else can perform this step.)
  3. Are all your predictions from 4.2 accomplished? Measurement units are preserved?
  4. Do the units make sense?
  5. Is reasonable the order of magnitude of results?
  6. Does it work for boundary values?
  7. Do every variable has an initial value?
  8. Interpret the result to write down an explanation of it (how it was produced) and assign units.


Copyright © 2002-2007 Jorge Vasconcelos. Johns Hopkins University, Department of Computer Science.

Return to the CS106 Homepage