4 ms·
It usually helps to have a systematic mathematical model for the problem you are trying to solve, and systematic mathematical models for the sub-problems into w
by drallison 6y ago
It usually helps to have a systematic mathematical model for the problem you are trying to solve, and systematic mathematical models for the sub-problems into which the full problem is decomposed. It is frequently better to conceive of each step in the program as ensuring some property is invariant rather than conceiving each step as performing some action.
It is probably better not to think of yourself as a coder or a programmer; consider yourself a problem solver with mathematical skills and move on to there.
Always convince yourself that the problem you are trying to solve has a solution.
- svrma 6y agoThanks for this! This is something I've been practicing of late. I realized that have a lot of problem in arguing the correctness of greedy algorithms. Do you have any recommendation for a collection of proof techniques useful for greedy algorithms?
- drallison 6y agoKinda depends whether by "correctness" you mean "proof". I always found Social Processes and Proofs of Theorems and Programs by Richard A. De Millo, Richard J. Lipton, and Alan J. Perlis inspirational. I do not know of any collection of proof techniques that would be uniformly useful for greedy algorithms. If you discover such a collection, please share it with me.