In this section, you've learned about Abstract Data Types (ADTs) and trained to implement some of them using Python classes. As mentioned in the beginning, the value in knowing how to build these ADTs yourself lies primarily in deepening your theoretical understanding of programming and knowing how to approach answering some tech interview questions.
Additional Resource
If you haven't already, take a moment to explore CodingNomads DSA course by clicking the link below.
Other Fundamental Abstract Data Structures
You learned about linked lists, stacks, and queues, but there are a couple of other fundamental ADT that you should take a look at as well.
Tree
A tree is a data structure that consists of nodes arranged in a hierarchy. Each node has a value and can have zero or more child nodes. Trees can be used to represent hierarchical data structures, such as a file system or a family tree. You can learn about the Binary Search Tree (BST) here and see a Python BST here.
Graph
A graph is a data structure that consists of nodes, which are also called vertices, and edges that connect them. Each node has a value and can be connected to one or more other nodes by an edge. Graphs can be used to represent relationships between different objects or entities.
Hash Table
A hash table is a data structure that allows you to store and retrieve data quickly by using a hash function to compute the index of an element in the table. Hash tables are often used for storing and looking up data in a database or for implementing efficient data structures such as dictionaries and sets. You can learn about the hash functions here, hash tables here and Python dictionaries (aka hash tables) here.
Even More Abstract
Your explorations of abstract data structures don't have to end there. These are just a few examples of the many abstract data structures that you can learn as a programmer.
Some other abstract data structures that you could explore build on the concepts of a linked list or a queue that you've already learned about but extend their functionality:
Give some of these a try and attempt to build them out using Python. You can search online for video walkthroughs, go full-on theoretical and derive the structure from the Wikipedia pages, or head over to GitHub to read the code someone else wrote to build these Abstract Data Types and find out whether you can understand and recreate their implementation.
Why Learn More about Abstract Data Structures?
There are several reasons why it's important to know about abstract data structures:
Understanding fundamental concepts
Abstract data structures are fundamental concepts in computer science that form the basis for many other data structures and algorithms. Understanding how they work and how they can be implemented can help you understand more complex concepts in computer science.
Designing efficient algorithms
Knowing about Abstract data structures can help you design more efficient algorithms by choosing the right data structure for the task at hand. For example, if you know that a particular problem is best solved using a stack, you can use the stack structures to implement your solution rather than trying to reinvent the wheel.
Working with libraries and frameworks
Many libraries and frameworks use abstract data structures as the basis for their data structures and algorithms. Understanding how abstract data structures work can help you better understand how these libraries and frameworks work and how to use them effectively.
Problem-solving
Abstract data structures can be a powerful tool for solving complex problems. By understanding how they work, you can break down complex problems into smaller pieces and solve them using the appropriate abstract data structure.
Knowing abstract data structures can also be helpful for a tech job interview because it demonstrates your knowledge of fundamental concepts, problem-solving skills, ability to design efficient algorithms, and understanding of how to work with libraries and frameworks.
Additional Resources
- david-legend on GitHub with an implementation of common Data Structures in Python
- YouTube on building ADT in Python
Summary: Additional Abstract Data Structures
- Abstract data structures are very useful in Python
- Abstract data structures are defined by their behavior rather than their implementation
- There are many reasons to learn the theory behind abstract data structures
- Other fundamental abstract data structures are Tree, Graph, and Hash Table
- Some examples of other abstract data structures in Python are Doubly-linked list, Circularly linked list, Circular Doubly-linked list, and Priority Queue
Why Learn Abstract Data Structures
- Understanding fundamental concepts
- Designing efficient algorithms
- Working with libraries and frameworks
- Problem solving