Only half of being a good programmer is knowing and being able to apply the syntax of your chosen language to write a program. The other half is the ability to actually find good solutions to the problems that the programs are meant to solve. This half of programming is seldom taught and many programmers never learn it resulting in a large percentage of programs using inefficient long winded ways of mostly solving the problem, and perhaps not solving it at all for some inputs.
In this series we will look at how Problem Solving can be applied to produce better solutions that properly solve problems using the minimum amount of code.
- Think outside the Box - if you assume constraints on a problem that don't actually exist you can make the problem far more difficult or even impossible to solve.
- Divide and Conquer - breaking up a problem into several smaller problems can make it easier to solve.
- Problem Solving and Logic - make sure you are solving the right problem and how sometimes knowing several things none of which by themselves solves the problem can give a solution.
- Use What You Know - by keeping any work you have previously done to solve problems (whether you used it or not) means you may already be part way to a solution to the next problem.
- Loops and Recursion - sometimes a problem can be broken up into multiple occurrences of the same smaller problem.
- Practice - an unsolved mathematical problem can provide a good opportunity to practice your problem solving. Test yourself on how far you can get with eliminating options before comparing to what others have determined.
- Designing a Program - Before you can solve all the problems a given program presents you must first identify what they all are by properly designing the program.