Sorting:
Bubble Sort:
The bubble sort is a simple sorting technique.Bubble sort is used to arranges the elements in ascending order,
for that it start with 1st element.The value of first element is compared with second element and if the value of first element is larger then the value will be interchange.
Selection Sort:
The selection sort is a direct sorting technique.
In this method we will find the smallest element from the array and then interchange with the first element.this process follows for whole array.
Insertion Sort :
The array element are compared with each other sequantially and then arranges together in specific order.
Merge Sort :
Merge sort is recursive sorting technique that frequently divides an array in to the two parts.If the array becomes null or having a single item than it is sorted.After that it compaers every divided parts and arrange it at last the sorted elements are merge together.
Quick Sort :
A large array is partitioned into two arrays one of which holds values smaller than the specified value, say pivot, based on which the partition is made and another array holds values greater than the pivot value.Quick sort partitions an array and then calls itself recursively twice to sort the two resulting subarrays.
Heap Sort :
Heap sort is a sorting technique whic uses the approach just opposite to selection sort.heap sort finds the largest element and put it at end of the array,
the second largest element is found and this process is repeated for all other elements
Radix sort/Bucket sort :
Radix sort is a method that can be used to sort a list of a number by its base. If we want to sort the list of English words, where radix or base is 26 then 26 buckets are used to sort the words.
To sort an array of decimal number where the radix or base is 10 we need 10 buckets and can be numbered as 0,1,2,3,4,5,6,7,8,9.
A number of passes required to have a sorted array depend upon the number of digits in the largest element.
EmoticonEmoticon