1、 外文原文 Simple Sorting Overview As soon as you create a significant database, youll probably think of reasons to sort it in various ways. You need to arrange names in alphabetical order, students by grade, customers by zip code, home sales by price, cities in order of increasing population, countries
2、by GNP, stars by magnitude, and so on. Sorting data may also be a preliminary step to searching it. As a binary search, which can be applied only to sorted data, is much faster than a linear search. Sorting is so important and potentially so time-consuming,it has been the subject of extensive resear
3、ch in computer science, and some very sophisticated methods have been developed. In this chapter well look at three of the simpler algorithms: the bubble sort, the selection sort, and the insertion sort. The techniques described in this chapter, while unsophisticated and comparatively slow, are neve
4、rtheless worth examining. Besides being easier to understand, they are actually better in some circumstances than the more sophisticated algorithms. The sorting algorithms are implemented as methods of similar array classes. Be sure to try out the Workshop applets included in this chapter. They are more effective in explaining how the sorting algorithms work than prose and static pictures could ever be. How Would You Do It? Imagine that your kids-league baseball team is lined up on the f