Sorting

A Sorting Algorithm is used to rearrange a given array or list elements according to a comparison operator on the elements

Usage

Importing Sorting from dsalib:

from dsalib import Sorting

Sorting Algorithms:

Bubble Sort

bubble_sort(array)

Sort given list using Bubble Sort technique.

Usage:

arr = [12, 2, 31, 45, 65, 23]
Sorting.bubble_sort(arr)

Insertion Sort

insertion_sort(array)

Sort given list using Insertion Sort Technique.

Usage:

arr = [12, 2, 31, 45, 65, 23]
Sorting.insertion_sort(arr)

Selection Sort

selection_sort(array)

Sort given list using Selection Sort Technique.

Usage:

arr = [12, 2, 31, 45, 65, 23]
Sorting.selection_sort(arr)

Merge Sort

merge_sort(array)

Sort given list using Merge Sort Technique.

Usage:

arr = [12, 2, 31, 45, 65, 23]
Sorting.merge_sort(arr)

Currently Library is under development, so we are going to add more sorting algorithms.