Quick Sort

Quick sort is one of the most widely used sorting algorithm due to its time complexity of O(n log n). It’s preferred over merge sort as it’s space efficient. Like merge sort, quick sort also follows divide and conquer strategy. … read the rest. “Quick Sort”

Quick Sort

Merge Sort

Merge sort is one of the most popular sorting algorithms being used. It follows divide and conquer approach. It splits the input list into 2 portions recursively till the split sub-array size is reduced to 1. While returning from recursion, … read the rest. “Merge Sort”

Merge Sort

Selection Sort

It’s a comparison based sort. It’s an inline sorting algorithm. The input array is iterated and sorted. At any time while sorting, there would sorted sub-array and unsorted sub-array. Minimum data element from the unsorted sub-array has been selected and … read the rest. “Selection Sort”

Selection Sort

Bubble Sort

Bubble sort is one of the simplest sorting algorithms. It’s a comparison based sort. It swaps adjacent elements in multiple passes until all the elements are sorted. Time complexity – O(n^2) as it involves loop within loop.

Java implementation of … read the rest. “Bubble Sort”

Bubble Sort