1. Bubble Sort
Bubble Sort is the simple sorting algorithm which repeatedly steps through the list, and compare adjacent elements , and swaps them if they are in the wrong order this Process is repeated until the list is sorted.
Bubble Sort Explanation – Tap on Me
2. Selection Sort
Selection Sort is a simple comparison-based sorting Algorithm. It works by dividing the list into two parts : – the sorted part at the end. Initially, the sorted part is empty and the unsorted part is the entire list. The algorithm repeatedly selects the smallest (or largest, depending on sorting order) element from the unsorted part and swaps it with the first element of the unsorted part.
Selection Sort Explanation – Tap on Me
3. Insertion Sort
Insertion Sort is a simple and intuitive comparison-based sorting algorithm. It builds the final sorted array one element at a time. It is much like sorting playing cards in yours hands; you take on card and insert it into its correct position relative to the already sorted cards.
Insertion Sort Explanation – Tap on Me
4. Merge Sort
Merge Sort is a divide-and-conquer algorithm that splits the array into smaller subarrays, sorts them, and then merges them back together. It is an efficient, stable, and comparison-based sorting algorithm.
Insertion Sort Explanation – Tap on Me
5. Quick Sort
Quick Sort is a highly efficient and widely used sorting algorithm that employs the divide-and-conquer strategy. 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.
Quick Sort Explanation – Tap on Me
6. Heap Sort
Heap Sort is a comparison-based sorting algorithm that uses a binary heap data structure to sort elements. It works by building a max-heap (or min-heap) from the input data and then repeatedly extracting the maximum (or minimum) element from the heap and rebuilding the heap until all elements are sorted.
Heap Sort Explanation – Tap on Me
7. Radix Sort
Radix Sort is a non-comparison-based sorting algorithm that sorts numbers by processing individual digits. It processes digits from the least significant to the most significant (LSD) or vice versa (MSD). The sorting is done using a stable subroutine like Counting Sort or Bucket Sort for each digit.
Radix Sort Explanation – Tap on Me
8. Counting Sort
Counting Sort is a non-comparison-based sorting algorithm suitable for sorting integers or objects according to keys that are small integers. It counts the number of objects that have distinct key values and uses arithmetic to determine the positions of each key in the output sequence.
Counting Sort Explanation – Tap on Me
9. Bucket Sort
Bucket Sort is a comparison-based sorting algorithm that distributes elements of an array into several buckets. Each bucket is then sorted individually, either using another sorting algorithm or by recursively applying the bucket sort. After sorting, the elements are concatenated to form the final sorted array.
Bucket Sort Explanation – Tap on Me
10. Shell Sort
Shell Sort, named after its inventor Donald Shell, is an in-place comparison-based sorting algorithm. It generalizes insertion sort by allowing the exchange of items that are far apart. The main idea is to arrange the list of elements so that, starting anywhere, taking every h-th element (for some integer h) yields a sorted list. Such a list is said to be h-sorted. After the initial h-sorting pass, h is reduced, and the process is repeated until h equals 1.
Shell Sort Explanation – Tap on Me