Sorting in arrays

Sorting is ordering the elements in array in ascending order.
There are various ways of sorting the arrays, but we will only discuss about the important one.

1. Selection Sort - Find the minimum element in the array and swap it with the element in the beginning.
2. Bubble Sort - Repeatedly swap the two adjacent elements when they are in wrong order ( wrong order = left element > right element).
3. Merge Sort - The merge sort technique is based on divide and conquer technique. We divide the while data set into smaller parts and merge them into a larger piece in sorted order.
4. Quick Sort - Select a random pivot and put it in the correct position and solve the right to left part recursively.
5. Count Sort - Sorting algorithm that sorts the elements of an array by counting the number of occurrences of each unique element.

Selection Sort

Bubble Sort


Quick sort



Merge Sort



Count sort



next