From e3c63d9e540e384d9afbfe6dff588b356e69f011 Mon Sep 17 00:00:00 2001 From: sonal251001 <73117995+sonal251001@users.noreply.github.com> Date: Tue, 25 May 2021 13:58:47 +0530 Subject: [PATCH] Add Selection Sort --- selectionSort.java | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 selectionSort.java diff --git a/selectionSort.java b/selectionSort.java new file mode 100644 index 0000000..4d6efbf --- /dev/null +++ b/selectionSort.java @@ -0,0 +1,43 @@ +public class selectionSort +{ + public static void main(String[] args) { + selectionSort obj = new selectionSort(); + + int a[] = {4, 2, -12, 22, 11}; + + obj.sort(a); + System.out.println("Sorted Array"); + obj.printArray(a); + } + + void sort(int a[]) + { + for(int i=0; i