This article comes from readers ' comments on my blog post. It is quite exciting to meet active thinkers and put forward the question of active thinking.
For a complete dialogue, see "C Language and Procedure design practice reference--n=a!+b!+c!" in the second floor review.
Problem
Teacher, I try to%¥#&......% ..., but the program becomes more, so will it improve efficiency?
Reply
I'm glad you can ask such a question, this kind of active thinking, in my physical class students really not much. This involves our multidimensional understanding of efficiency.
In most cases, efficiency refers to the efficiency of the computer, with time efficiency (as little as possible) and space efficiency (less memory footprint in operation). And the focus on time efficiency is the majority. As a result, the number of lines of source code is not the key to determining the efficiency of the time, as long as the final target code, so that the computer to perform fewer operations, the time angle is naturally fast. And another dimension of efficiency, we also have to realize that that is human efficiency. Computer systems are synthesized by computers and people, in fact, people's efficiency is more valuable, which in the current situation of the increase in human costs, some companies are very critical. For a problem that is not too complex, or if the computer is inefficient but sufficient to meet the needs, the "person" as a developer does not have to spend too much effort on the efficiency of the computer. One of the most critical aspects of a system, affecting the system performance of the "bottleneck" part, it is worth to spend a lot of manpower, as well as very Smart's head, to pursue the efficiency of the computer. This is why a lot of beginners are not aware of the need to learn the algorithm (although good novice programmers, algorithm literacy is not engraved in effect). Your solution, obviously the efficiency of the computer is high, people's efficiency is low. What's more, the algorithm is complicated and the likelihood of error is even greater. Any project that follows the law of "simplicity is beauty".
To answer such questions, be happy, say a few more words.
Of course, as learners, especially beginners, your "human inefficiency", just from the learning angle is the most efficient, the value of training thinking is quite large. Keep this thinking and questioning going!
The question of efficiency for beginners