From 005218f301c861755dfb1e255b73c7153f74f6d5 Mon Sep 17 00:00:00 2001 From: amanaolsingh <115914853+amanaolsingh@users.noreply.github.com> Date: Mon, 17 Oct 2022 12:59:48 +0530 Subject: [PATCH] Create SelectionSort.java --- SelectionSort.java | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 SelectionSort.java diff --git a/SelectionSort.java b/SelectionSort.java new file mode 100644 index 0000000..d3b6400 --- /dev/null +++ b/SelectionSort.java @@ -0,0 +1,40 @@ +import java.util.Scanner; + +public class SelectionSort +{ + public static void main(String args[]) + { + int size, i, j, temp; + int arr[] = new int[50]; + Scanner scan = new Scanner(System.in); + + System.out.print("Enter Array Size : "); + size = scan.nextInt(); + + System.out.print("Enter Array Elements : "); + for(i=0; i arr[j]) + { + temp = arr[i]; + arr[i] = arr[j]; + arr[j] = temp; + } + } + } + + System.out.print("Now the Array after Sorting is :\n"); + for(i=0; i