Skip to content

This repository contains several sorting algorithms and their optimised algorithms.

Notifications You must be signed in to change notification settings

umareefarooq/Sorting-Algorithms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sorting-Algorithms

This repository contains the following several sorting algorithms and some with their optimised forms as well.

  1. Selection Sort

    The smallest element is selected from the unsorted array and swapped with the leftmost element, and that element becomes a part of the sorted array. This process continues moving unsorted array boundary by one element to the right.

  2. Bubble Sort

    Bubble sort is a basic algorithm for arranging a string of numbers or other elements in the correct order. The method works by examining each set of adjacent elements in the string, from left to right, switching their positions if they are out of order.

  3. Recursive Bubble Sort

    Recursive bubble sort is the sorting algorithm used to arrange a list in a particular form that can be ascending or descending in numerical or lexicographical order using recurrsion technique.

  4. Insertion Sort

    Insertion sort is a sorting algorithm in which the elements are transferred one at a time to the right position. In other words, an insertion sort helps in building the final sorted list, one item at a time, with the movement of higher-ranked elements. An insertion sort has the benefits of simplicity and low overhead.

  5. Recursive Insertion Sort

    Same above insertion sort technique using recursion.

  6. Merge Sort

    Merge sort is one of the most efficient sorting algorithms. It works on the principle of Divide and Conquer. Merge sort repeatedly breaks down a list into several sublists until each sublist consists of a single element and merging those sublists in a manner that results into a sorted list.

  7. Iterative Merge Sort

    Same above merge sort technique using recursion.

  8. Iterative Quick Sort

    Quick sort using Recusrion or we can call it the Iterative Quick Sort.

  9. Quick Sort

    Quicksort is a divide-and-conquer algorithm. It works by selecting a 'pivot' element from the array and partitioning the other elements into two sub-arrays, according to whether they are less than or greater than the pivot. ... The sub-arrays are then sorted recursively.

  10. Heap Sort

    Heap sort is a comparison based sorting technique based on Binary Heap data structure. It is similar to selection sort where we first find the maximum element and place the maximum element at the end. We repeat the same process for the remaining elements.

  11. Counting Sort

    Counting sort is a stable sorting technique, which is used to sort objects according to the keys that are small numbers. It counts the number of keys whose key values are same. This sorting technique is effective when the difference between different keys are not so big, otherwise, it can increase the space complexity.

  12. Radix Sort

    Radix sort is one of the sorting algorithms used to sort a list of integer numbers in order. In radix sort algorithm, a list of integer numbers will be sorted based on the digits of individual numbers. ... For example, if the largest number is a 3 digit number then that list is sorted with 3 passes.

  13. Bucket Sort

    Bucket sort, or bin sort, is a sorting algorithm that works by distributing the elements of an array into a number of buckets. Each bucket is then sorted individually, either using a different sorting algorithm, or by recursively applying the bucket sorting algorithm.

  14. Shell Sort

    Shell sort is a sorting algorithm that first sorts the elements far apart from each other and successively reduces the interval between the elements to be sorted. It is a generalized version of insertion sort. In shell sort, elements at a specific interval are sorted.

  15. Comb Sort