Skip to Content
Data Structures and Algorithms in Java, 2nd Edition
book

Data Structures and Algorithms in Java, 2nd Edition

by Robert Lafore
September 2017
Intermediate to advanced
800 pages
23h 19m
English
Sams
Content preview from Data Structures and Algorithms in Java, 2nd Edition

3. Simple Sorting

As soon as you create a significant database, you’ll 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 by GNP, stars by magnitude, and so on.

Sorting data may also be a preliminary step to searching it. As we saw in Chapter 2, “Arrays,” a binary search, which can be applied only to sorted data, is much faster than a linear search.

Because sorting is so important and potentially so time-consuming, it has been the subject of extensive ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Data Structures and Algorithms in Java, 6th Edition

Data Structures and Algorithms in Java, 6th Edition

Michael T. Goodrich, Roberto Tamassia

Publisher Resources

ISBN: 9780134849775