# 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.

## List:

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

``l1=[34,56,78,'list',(2,3)]``

## Sets:

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:

``s1={2,45,(4.5,7),s}``

## Tuple:

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

``t1=(1,2,3,(67,78),'tuple')``

## Dictionary:

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:

``d1={1:a,2:b,3:c}``

Some of the user defined data structures are as follows:

## Array:

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

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

## Stack:

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.

## Queue:

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.

## Graph:

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