- Sorting
- Selection sort
- Topological Sort
- Heap Sort
- huffman coding compression algo
- prims algorithm
- kruskal algorithm
- dijkstra algorithm
- coin change problem
- fractional knapsack
- disjoint sets

**What is selection sort?**

It is a sorting technique that is based on the partitioning of array into two parts, sorted and unsorted.

The process is:-

1) Find minimum element in unsorted array.

2) Swap the element at the end of sorted array.

when i=0 we don't have any sorted array so element will be replaced from first element later the sorted array end will growas the index.

**Steps:-**

underline elements are sorted array, the length is increasing with each minimum element added at the end.minimum element11 1125122264 minimum element12 1112252264 minimum element22 1112222564 minimum element25 1112222564 minimum element64 1112222564

**Program:-**

package sorting;publicclassSelectionSort{//function to print arraypublicstaticvoidprint(int[] arr){for(int i=0;i<=arr.length-1;i++) System.out.print(" "+arr[i]); System.out.println(" ");}//function to swap elementspublicstaticint[]swap(int[] arr,int i,int j){int temp; temp=arr[i]; arr[i]=arr[j]; arr[j]=temp…

## Comments

## Post a Comment