Problem:
given m<n, generate random numbers of m within range(0..n).
Solutions:
1 | select = m |
But when n was large, it meets bootleneck. Improve with:
1 |
|
f
Principles
Understand the Perceived Problem
talk to user
Specify an Abstract Problem
get a clean, crisp problem statement.
Explore the Desgn Space
think for a day and code for a min rather than per contra
Implmnt One Solution
choose the best
Retrospect
Polya’s delightful How to Solve It can help programmer become a better problem solver.