8) Abstract Data Structures Lesson

Python Abstract Data Structures

4 min to complete · By Martin Breuss

You have already learned about many data structures in Python, such as lists, tuples, and dictionaries. As a high-level language, Python already comes pre-packaged with many useful data structures.

For example, you might have heard about hash tables. These are implemented in Python as dictionaries.

Great! So, you already know powerful data structures that you can build almost anything with. So what are abstract data structures, and why would you learn about them at all?

Abstract Data Structure Definition

An Abstract Data Structure (ADS) differs from a concrete data structure in that it is defined by its behavior rather than by the way it is built. For instance, a Python list is a concrete data structure. It is defined by how it's built in Python. Linked Lists, Stacks, Queues, Hash Maps, Trees, and many other Abstract Data Structures, on the other hand, are defined by their theoretical rules and behaviors.

Turns out that you probably won't find many use cases where it makes sense to use Abstract Data Structures in Python, especially if you implement them yourself. That's where you'll want to rely on the programmers who came before you and built sturdy concrete data structures based on these abstract ones. They'll have delightful APIs that do the hard work for you.

Why Learn Abstract Data Structures

But now that you're already a bit down the road on your Python programming journey, there are still some good reasons why you'll want to learn about Abstract Data Structures:

  • Theory: Learn more about computer science topics, specifically data structure theory
  • Practice: Train your programming and algorithm skills in Python
  • Jobs: Prepare for a job interview

The truth is that some job interviews will still quiz you on theoretical computer science topics, such as Abstract Data Structures, even when they might not have a big impact on your day-to-day as a programmer.

But even if you're not planning to interview with a company that handles interviews that way, learning about some Abstract Data Structures is great practice for your Python OOP skills. And you know that learning to program is all about training!

Summary: Abstract Data Structures

  • Python comes with many concrete pre-built data structures
  • Abstract data structures s are defined by their behavior, not by the way they're built
  • Learning how to implement abstract data structures will help to approach more theoretical aspects of programming and job interviews