DataStructures - Basic concept

Posted on October 11th, 2021
Author: Sanjana Sogimatt

Basic data structures:

Python has four basic structure namely Lists,Dictionary,Tuple and sets. These data structures are in built that come along with python and we also have user defined data structure.


Lists are the type of container which can store data of different types in the memory.Lists are created using '[]'(square braces) Example:



Sets are again similar to lists and tuples but diffrence would be it does not store duplicate values.It is enclosed in curly braces{} Example:



Tuple is similar to Lists but the diffrence is tuples are immutable where lists are mutable.Tuples are created using round braces() Example:



Okay now dictionary are not at all like lists. These data structures store key-value pair. Take an anology of a dictionary where there is a word and a meaning to that. Dictionaries in python are created using curly braces. Example:


Some of the user defined data structures are as follows:


These data structures are similar to lists but it is homogeneous that is the elements having same datatype.

Linked list:

These are the data structure that holds the value of next element using pointers.


These data structure follow the principle of last in first out. Basically, we can access only the last entered value. We can also do operations like push or pop.


These are the data structures that work following the principle of first in first out. You totally relate it to a queue in real life.

Hash maps:

Hash maps are same as dictionaries in python.


Graphs stores the data in the collection of points called vertices and edges.