When we solve a problem, we need to think like ourselves.
When we write a program to solve a program, we need to think like computers.
In other words, while writing a program, you need to transfer your thinking process to the computer.
For example, many of us can play chess very well. But it wouldn’t be possible for the best among us to write a program that plays real, intelligent, chess.
Good programming goes one step beyond problem-solving: You don’t just need the ability to solve a problem, but you need to know the exact thought process that led you to solve the problem.
Without this skill, programming is just a confusing, zigzag path of trials-and-errors and hence, ends up being stressful, long-drawn activity.
For example, we all have played the 15-puzzle (Fifteen_puzzle) some time or the other. It is a very simple puzzle and most of us can solve it within minutes.
Now, try writing a program to solve the 15-puzzle, and you will notice the difference between “solving a problem” and “writing a program to solve a problem”.
What does it take to learn how to “write a program to solve a problem”?
This tutorial will show you how a systematic thinking can help you write the most complicated programs with absolute ease, within minutes.
This is done through a case-study. In the next section, a programming problem is defined in detail.
Do give the problem sufficient try before looking at the further sections.
However, make sure you take appropriate help from the sections so that we remain on track.
The tutorial is designed you help you think through the problem systematically, ask the right questions, and take small, incremental but confident steps to writing the complete working program of the given problem within minutes.