# Python Data Structure

## Python Data Structure and Algorithm Tutorial – Radix Sort Algorithm

Radix Sort Algorithm   In this tutorial, you will learn how radix sort works. Also, you will find working examples of radix sort in Python. Radix sort is a sorting technique that sorts the elements by first grouping the individual digits of the same place value. Then, sort the elements according to their increasing/decreasing order. Suppose, …

## Python Data Structure and Algorithm Tutorial – Counting Sort Algorithm

Counting Sort Algorithm   In this tutorial, you will learn how counting sort works. Also, you will find working examples of counting sort in Python. Counting sort is a sorting algorithm that sorts the elements of an array by counting the number of occurrences of each unique element in the array. The count is stored …

## Python Data Structure and Algorithm Tutorial – Quicksort Algorithm

Quicksort Algorithm   In this tutorial, you will learn how quicksort works. Also, you will find working examples of quicksort in Python. Quicksort is an algorithm based on divide and conquer approach in which the array is split into subarrays and these sub-arrays are recursively called to sort the elements. How QuickSort Works? A pivot …

## Python Data Structure and Algorithm Tutorial – Insertion Sort Algorithm

Insertion Sort Algorithm   In this tutorial, you will learn how insertion sort works. Also, you will find working examples of insertion sort in Python. Insertion sort works similarly as we sort cards in our hand in a card game. We assume that the first card is already sorted then, we select an unsorted card. …

## Python Data Structure and Algorithm Tutorial – Selection Sort Algorithm

Selection Sort Algorithm   In this tutorial, you will learn how selection sort works. Also, you will find working examples of selection sort in Python.   Selection sort is an algorithm that selects the smallest element from an unsorted list in each iteration and places that element at the beginning of the unsorted list. How …

## Python Data Structure and Algorithm Tutorial – Bubble Sort Algorithm

Bubble Sort Algorithm   In this tutorial, you will learn how bubble sort works. Also, you will find working examples of bubble sort in Python. Bubble sort is an algorithm that compares the adjacent elements and swaps their positions if they are not in the intended order. The order can be ascending or descending. How …

## Python Data Structure and Algorithm Tutorial – Bellman Ford’s Algorithm

Bellman Ford’s Algorithm   Bellman Ford algorithm helps us find the shortest path from a vertex to all other vertices of a weighted graph. It is similar to Dijkstra’s algorithm but it can work with graphs in which edges can have negative weights. Why would one ever have edges with negative weights in real life? Negative weight …

## Python Data Structure and Algorithm Tutorial – DFS Algorithm

DFS Algorithm   In this tutorial, you will learn what a DFS algortihm is. Also, you will find working examples of DFS algorithm in C, C++, Java and Python. Traversal means visiting all the nodes of a graph. Depth first traversal or Depth first Search is a recursive algorithm for searching all the vertices of a …

## Python Data Structure and Algorithm Tutorial – Adjacency List

Adjacency List   In this tutorial, you will learn what an adjacency list is. Also, you will find working examples of adjacency list in Python. An adjacency list represents a graph as an array of linked lists. The index of the array represents a vertex and each element in its linked list represents the other …

## Python Data Structure and Algorithm Tutorial – Adjacency Matrix

Adjacency Matrix   In this tutorial, you will learn what an adjacency matrix is. Also, you will find working examples of adjacency matrix in Python. An adjacency matrix is a way of representing a graph G = {V, E} as a matrix of booleans. Adjacency matrix representation The size of the matrix is VxV where V is the number …

## Python Data Structure and Algorithm Tutorial – Strongly Connected Components

Strongly Connected Components   In this tutorial, you will learn how strongly connected components are formed. Also, you will find working examples of kosararju’s algorithm in Python. A strongly connected component is the portion of a directed graph in which there is a path from each vertex to another vertex. It is applicable only on a directed …

## Python Data Structure and Algorithm Tutorial – Spanning Tree and Minimum Spanning Tree

Spanning Tree and Minimum Spanning Tree   In this tutorial, you will learn about spanning tree and minimum spanning tree with help of examples and figures. Before we learn about spanning trees, we need to understand two graphs: undirected graphs and connected graphs. An undirected graph is a graph in which the edges do not point in …