Data Structures in Python: Introduction
If you are programming for some time in any language you must have heard word data structures from your colleague or someone else. Whichever language you are studying at least once you must go through data structures. In this series, our focus will be on data structures with python(python3).
Overview
First of all, don’t confuse yourself between data structures and data stored in data storage. Data stored is different from data structures.
Data Structures is a fundamental concept in computer science that helps us in writing efficient programs so that it works fast and we can manage the space it takes in memory every time it runs.
In this lecture, I will provide a short overview of some frequently used data structures in python. Just read it once to get an overview and it's good if you are having confusion coz we will dive deep into each type one by one from the next lecture onwards.
General Data Structures
Various data structures in computer science are divided into two categories given below:
Linear Data Structures
These are the data structures where elements are stored in a sequential manner:
Array — It is a sequential arrangement of data elements paired with an index(address) of data elements.
Linked List— Each element contains a link to the next element along with data.
Stack — This is similar to what you imagine with the stack. It’s like a stack of elements following a specific order of operation. LIFO(Last In First Out) or FILO(First In Last Out).
Queue — This is similar to stack but the order of operation is FILO(First In First Out).
Matrix— It is a two-dimensional data structure in which the data element is referred to by a pair of indices
Non-Linear Data Structures
These are the data structures in which there is no sequential linking of data elements.
Binary Tree — It is a data structure where each data element is connected to a maximum of two other data elements. It starts with the root node.
Heap— This is a special case of tree data structures where data in the parent node is strictly greater than or equal to child nodes or strictly less than child nodes.
Hash Table— It is a data structure that is made of arrays associated with each other using a hash function. It retrieves values using keys instead of indexes.
Graph— It is an arrangement of vertices and nodes where some of the nodes are connected to each other through links.
Python Built-In Data Structures
These are the data structures provided with python. They give greater flexibility in storing different types of data and faster processing in a python environment.
List — It is similar to an array with the exception that data elements can be of different data types. You can have both numeric and string data in a python list.
Tuple — Tuples are similar to lists but they are immutable which means the values in a tuple cannot be modified they can only be read.
Dictionary— It contains Key-value pairs as its data elements
In the next lesson, we will dive deep into these data structures and clear our concept.
Lectures
Lecture 1: https://medium.com/@saifmdco/data-structures-with-python-introduction-4dadeffa2215
Lecture 2: https://medium.com/@saifmdco/data-structures-with-python-arrays-c498518bf7fd
Lecture 3: https://medium.com/@saifmdco/data-structures-in-python-lists-653a3ad103ab
Lecture 4: https://medium.com/@saifmdco/data-structures-in-python-tuples-3c350640cd9a
Lecture 5: https://medium.com/@saifmdco/data-structures-in-python-dictionary-fad27ffdda8b
Lecture 6: https://medium.com/@saifmdco/data-structures-in-python-2d-array-6bc0154aa717
Lecture 7: https://medium.com/@saifmdco/data-structures-in-python-matrix-22adba5aa597
Lecture 8: https://medium.com/@saifmdco/data-structures-in-python-sets-92d5445e97e8
Lecture 9: https://medium.com/@saifmdco/data-structures-in-python-chainmap-fca2a9d47249
Lecture 10: https://medium.com/@saifmdco/data-structures-in-python-linkedlist-50f2118c659e
Lecture 11: https://medium.com/@saifmdco/data-structures-in-python-stack-6bf182d63581
Lecture 12: https://medium.com/@saifmdco/data-structures-in-python-queue-6361d3dcff0
Lecture 13: https://medium.com/@saifmdco/data-structures-in-python-dequeue-1a585e269a55
Lecture 14: https://medium.com/@saifmdco/data-structures-in-python-custom-stack-b7b9173b4eae
Lecture 15: https://medium.com/@saifmdco/data-structures-in-python-hash-table-39be784eefc1
Lecture 16: https://medium.com/@saifmdco/data-structures-in-python-doubly-linked-list-fe698d74756c