Algorithm Interview Topics, Vol. 1

Linked Lists in Python, Explained

How to Use Single & Doubly Linked Lists

Paul Torres
Analytics Vidhya
Published in
5 min readApr 3, 2021

--

Photo by Bryson Hammer on Unsplash

A linked list is a linear data structure whose elements are not stored in a continuous location. This means that a linked list contains separate vacuoles known as ‘nodes’, which contain the data they were created to contain and a reference to another node in the list.

Some advantages of a linked list are its discontinuous nature and its reading time never going above O(n). A linked list does not need to be stored continuously because it has references built into each node for the location of the next in order. If space in your computer’s memory is sparse, a linked list is ideal as the entire structure doesn’t need to be stored in one location. That also means reading a linked list is linear as the size of the list approaches infinity.

However, the disadvantages make it a specialty case. Also, if an addition is made to the list the entire list must be updated so that the references remain correct. The sequential nature of a linked list means there is no random access allowed. Each node must be read in the order it was created to have access to all of the information needed.

In this article, we are going to go over the concept of singular and doubly linked lists…

--

--

Paul Torres
Analytics Vidhya

Data Scientist with a Physicist’s heart. Looking through numbers to tell a story that people will care about.