读书笔记-《Algorithms in Java》-第一章-07/10/11 - Raylong

《Algorithms in Java: Parts 1-4, Third Edition》是一本用Java语言讲解算法的书,我正在阅读中。因为是英文原版的,复习的时候不容易看。因为中国人嘛,对母语的反应是最快的。虽然英语不是很好,以前也没翻译过什么东西,但是还是想尽我所能,以意译为主吧,学好算法这门必修课,和大家共同分享。

2007年10月11日 21:00:01
2007年10月12日 8:35:34 翻译

Form:《Algorithms in Java: Parts 1-4, Third Edition》

1、 Most algorithms of interest involve methods of organizing the data involved in the computation. Objects created in this way are called data structures, and they also are central objects of study in computer science. Thus, algorithms and data structures go hand in hand.
大多数重要的算法,包含了在计算中方法需要处理的组织起来的数据。以这种方式创建的对象我们称之为数据结构。它们也是计算机科学研究和核心问题。因此,数据结构和算法是密不可分的。
(特定的数据结构有特定的算法,比如:估算降雨量要用毫米数,不能用雨滴的个数。在这种问题上,越是精确,越是没意义。模糊数学里的东西。)

2、 Careful algorithm design is an extremely effective part of the process of solving a huge problem, whatever the applications area.
无论在什么应用领域,精心设计的算法能够非常高效地解决大的问题。
(好像听人说过,一种科学,如果没用上数学,那就称不上是严谨的科学。大概这个意思吧。)

3、 When a huge or complex computer program is to be developed, a great deal of effort must go into understanding and defining the problem to be solved, managing its complexity, and decomposing it into smaller subtasks that can be implemented easily.
当要开发一个复杂的计算机程序,必须付出巨大的努力理解和定义问题的解决方式,管理复杂度,把它分解成可以很容易实现的子任务。
(分而治之是最基本的思想)

4、 The Java libraries contain implementations of a host of fundamental algorithms. However, implementing simple versions of basic algorithms helps us to understand them better and thus to more effectively use and tune advanced versions from a library. More important, the opportunity to reimplement basic algorithms arises frequently. The primary reason to do so is that we are faced, all too often, with completely new computing environments (hardware and software) with new features that old implementations may not use to best advantage. In other words, we often implement basic algorithms tailored to our problem, rather than depending on a system routine, to make our solutions more portable and longer lasting. Another common reason to reimplement basic algorithms is that, despite the advances embodied in Java, the mechanisms that we use for sharing software are not always sufficiently powerful to allow us to conveniently tailor library programs to perform effectively on specific tasks.
java库包含了大量的基础算法的实现。然而,实现简单版本的基本算法帮助我们更好地理解它们,这样就能更高效地 运用它们,并且从库中使用更高级的版本。更重要的是,重新实现基本算法的机会变得很频繁。这样做的主要原因是我们会遇到,并且经常遇到全新的计算机环境 (软件和硬件),这样旧有的实现就可能不是最佳的了。换句话说,我们经常根据我们的问题实现基本算法,而不是例行公事地,让我们的解决方案更便捷、持续得 更长久。另一个很普遍的原因是重新实现基本的算法,不管java包含的算法如何优秀,我们在设计软件时采用它实现的机制,并不能总是满足我们特定任务的需 要。
(也就是说在特定的情况下,需要我们根据问题来实现基本的算法,而不是java的库,库只是通用的,有时并不能满足特定的需要。不要以为学习基本算法是在重新发明轮子。有个叫刘喆的同学也说过类似的话^_^)

5、 Computer programs are often overoptimized. It may not be worthwhile to take pains to ensure that an implementation of a particular algorithm is the most efficient possible unless the algorithm is to be used for an enormous task or is to be used many times.
计算机程序经常地被过度地优化。有时,努力地确保一个算法的实现是最高效的并不值得,除非那个算法被用来处理复杂的任务,或者会被多次地使用。
(在 Joshua Bloch著的《Effective Java》中有过相同的论述,很有意思。他提出两条规则:第一条,不要做优化。第二条,(仅针对专家)还是不要做优化---也就是说,在你没有绝对清晰的 未优化方案之前,请不要做优化。他是java库的设计者之一,说话的分量够重吧。现在好像跳到google了。)

6、 We do pay careful attention to carefully coding the critical parts of the algorithms, and take pains to note where low-level optimization effort could be most beneficial.
我们一定要特别注意仔细地为算法关键部分的编码,努力地注意以很小代价做的优化,获得最好的效果。
(也就是算法中最核心的部分,有点80/20原则的意味。)

7、 The choice of the best algorithm for a particular task can be a complicated process, perhaps involving sophisticated mathematical analysis. The branch of computer science that comprises the study of such questions is called analysis of algorithms.
为一个特定的任务选择最佳算法可能是一个复杂的过程,也许包含了精密的数学分析。算法分析就是研究这种问题的学科,它是计算机科学的一个分支。
(看来学计算机要学的深入,不学数学是不行的,我得恶补一下了。)

8、 We should not use an algorithm without having an idea of what resources it might consume, and we strive to be aware of how our algorithms might be expected to perform.
我们不应该只是使用一个算法,而不在意他消耗了多少资源(时间和空间),我们应该密切留意我们的算法能否达到预期的效果。
(生了孩子就要对他/她负责,否则就不要生他/她。)

你可能感兴趣的:(读书笔记-《Algorithms in Java》-第一章-07/10/11 - Raylong)