7 Abstract data types: Designing the simplest container—the bag

In this chapter

  • the difference between an abstract data type and a data structure
  • arrays and linked lists: are they data structures or data types
  • the key properties of a container
  • meet the bag, the simplest possible container

By now, you should be familiar with arrays and linked lists, which were the focus of our first six chapters. These are core data structures, ubiquitous in computer science and software engineering. But more than that, they are also foundational data structures, which means that we can—and will—build more complex data structures on top of them.

In chapter 2, we discussed how arrays can be approached as concrete language features or as abstract data types. In ...

Get Grokking Data Structures 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.