15. When to Use What

In this chapter we briefly summarize what we’ve learned so far, with an eye toward deciding what data structure or algorithm to use in a particular situation.

This chapter comes with the usual caveats. Of necessity, it’s very general. Every real-world situation is unique, so what we say here may not be the right answer to your problem. This chapter is divided into these somewhat arbitrary sections:

• General-purpose data structures: arrays, linked lists, trees, hash tables

• Specialized data structures: stacks, queues, priority queues, graphs

• Sorting: insertion sort, Shellsort, quicksort, mergesort, ...

Get Data Structures and Algorithms in Java, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.