Data Structures in Python
- 4 minsThe following is a list of published articles I wrote about data structures in Python.
Guide to Heaps in Python
After reading this guide, you’ll be able to understand heaps from the ground up. We started by demystifying what heaps are and their inherent properties. From there, we dove into Python’s own implementation of heaps, the heapq
module, and explore its rich set of functionalities.
So, if you’ve ever wondered how to efficiently manage a dynamic set of data where the highest (or lowest) priority element is frequently needed, you’re in for a treat.
[Read more here]
Guide to Hash Tables in Python
In this guide, we dove into the world of hash tables. We started with the basics, explaining what hash tables are and how they work.
We also explored Python’s implementation of hash tables via dictionaries, provided a step-by-step guide to creating a hash table in Python, and even touched on how to handle hash collisions.
Along the way, we demonstrated the utility and efficiency of hash tables with real-world examples and handy Python snippets.
[Read more here]
Guide to Queues in Python
For developers, especially in Python, queues aren’t just theoretical constructs from a computer science textbook. They form the underlying architecture in many applications.
In this guide, we dove deep into the concept of queues, exploring their characteristics, real-world applications, and most importantly, how to effectively implement and use them in Python.
[Read more here]
Guide to Stacks in Python
Over the years, stacks have found their applications in a plethora of areas, from memory management in your favorite programming languages to the back-button functionality in your web browser. This intrinsic simplicity, combined with its vast applicability, makes the stack an indispensable tool in a developer’s arsenal.
In this guide, we explained the concepts behind stacks, their implementation, use cases, and much more. We defined what stacks are, how they work, and then, we’ll take a look at two of the most common ways to implement stacks in Python.
[Read more here]
Guide to Arrays in Python
An array is a structured way to store multiple items (like numbers, characters, or even other arrays) in a specific order, and you can quickly access, modify, or remove any item if you know its position (index).
Arrays stand as one of the most fundamental and widely used data structures.
In this guide, I gave you a comprehensive overview of the array data structure. First of all, I took a look at what arrays are and what are their main characteristics. I then transitioned into the world of Python, exploring how arrays are implemented, manipulated, and applied in real-world scenarios.
[Read more here]
Guide to Sets in Python
They might seem similar to lists or dictionaries, but sets come with their own set of properties and capabilities that make them indispensable in certain scenarios.
In this guide, we took a look at sets in Python. We started by understanding the foundational concepts of the set data structure, and then dive into Python’s specific implementation and the rich set of operations it offers.
By the end of this guide, you’ll have a solid grasp of when and how to use sets in your Python projects.
[Read more here]
Guide to Lists in Python
At its core, a list represents a collection of elements (be it numbers, strings, objects, or even other data structures) organized in a linear fashion, where each element has a specific position.
This basic yet powerful concept allows for a plethora of operations and manipulations, forming the backbone of many complex data management tasks in software development.
In that sense, Python, as one of the most versatile and widely used programming languages, has a built-in list data structure, which is one of the most powerful and flexible data structures in Python.