diff --git a/selectionshort.java b/selectionshort.java new file mode 100644 index 0000000..29b31e7 --- /dev/null +++ b/selectionshort.java @@ -0,0 +1,49 @@ +// import java.util.*; +// public class selectionshort{ +// public static void printarray(int arr[]){ +// for(int i=0;iarr[j]){ +// smallest=j; +// } +// } +// int temp=arr[smallest];//using swap condition +// arr[smallest]=arr[i]; +// arr[i]=temp; +// } +// printarray(arr); + +// } +// } +import java.util.*; +public class selectionshort{ + public static void printarray(int arr[]){ + for(int i=0;iarr[j]){ + smallest=j; + } + } + int temp=arr[smallest]; + arr[smallest]=arr[i]; + arr[i]=temp; + } + printarray(arr); +} +} \ No newline at end of file