Python Data Structures: Your Starter Kit to Learning Algorithms

Arrays, Linked Lists, Stacks, Queues and Hash Tables.

Mohammad Al Abdallah
The Startup

--

Working with any kind of algorithm starts with learning a set of data structures associated with it. This makes sense since most algorithms work on some kind of data that must be stored and held somehow, somewhere. That’s where data structures come handy!

Data Structures are used to organize information and data in a variety of ways such that an algorithm can be applied to the structure in the most efficient way possible.

In this post, I will give a basic introduction to the most common data structures used. I will do so using the Python language. By the end of the post, you will gain your first introduction to arrays, linked lists, stacks, queues, and hash tables in Python.

Let’s get started!

Arrays

An array is a collection of elements where the position of each element is defined by an index or a key value. A one-dimensional array, for example, contains a linear set of values. In an array, element position can be calculated mathematically thus enabling array elements to be accessed directly. Since the position of each element in the array can be directly computed, we do not need to navigate the entire data structure…

--

--