Caribbean Secondary Education Certificate - Information Technology/Problem Solving and Program Design

From WikiEducator
Jump to: navigation, search

Principles of Problem Solving

There are no hard and fast rules that will ensure success in solving problems. However, it is possible to outline some general steps in the problem-solving process and to give some principles that may be useful in the solution of certain problems. These steps and principles are just common sense made explicit. (Calculus, 6th Ed.; Stewart)

Understand the Problem

  • What are we trying to find? What is the unknown? What are the given quantities? What are the given conditions?
  • We may want to draw a diagram, or to introduce suitable notation (choose letters for unknown quantities).

Think of a plan

  • Try to recognize something familiar.
  • Try to recognize patterns.
  • Use analogy.
  • Introduce something extra (eg., a new line in a diagram).
  • Take cases.
  • Establish subgoals.
  • Use indirect reasoning: a) use proof by contradiction (assume that something is true and show that this leads to a contradiction);
    • start with the solution that you may know (or guess) and work backwards.

Carry out the plan

Check each stage of the plan and write the details that prove that each stage is correct.

Look back

  • Look for errors in the solution.
  • Look to see if the answer makes sense.
  • Familiarize ourselves with the method of solution in case this method may be useful in solving a future problem.

Additional Reading Material


Pseudo Code

Pseudocode is a compact and informal high-level description of a computer programming algorithm that uses the structural conventions of some programming language, but is intended for human reading rather than machine reading. Pseudo-code typically omits details that are not essential for human understanding of the algorithm, such as variable declarations, system-specific code and subroutines. The programming language is augmented with natural language descriptions of the details, where convenient, or with compact mathematical notation. The purpose of using pseudocode is that it is easier for humans to understand than conventional programming language code, and that it is a compact and environment-independent description of the key principles of an algorithm. It is commonly used in textbooks and scientific publications that are documenting various algorithms, and also in planning of computer program development, for sketching out the structure of the program before the actual coding takes place.

No standard for pseudocode syntax exists, as a program in pseudocode is not an executable program. Pseudocode resembles, but should not be confused with, skeleton programs including dummy code, which can be compiled without errors. Flowcharts can be thought of as a graphical alternative to pseudocode.


<variable> = <expression>

if <condition>

   do stuff


   do other stuff

while <condition>

   do stuff

for <variable> from <first value> to <last value> by <step>

   do stuff with variable

function <function name>(<arguments>)

   do stuff with arguments
   return something

<function>(<arguments>) // Function call