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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.