From 78b0bdbceae983cbf178754b590124cd665eb211 Mon Sep 17 00:00:00 2001 From: Hvr123 <133820482+HarshVR1947@users.noreply.github.com> Date: Sun, 22 Oct 2023 00:54:38 +0530 Subject: [PATCH] Cyclic Sort code in Java Added a java code file for CycleSort Signed-off-by: Hvr123 <133820482+HarshVR1947@users.noreply.github.com> --- JAVA/Cyclesort.java | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 JAVA/Cyclesort.java diff --git a/JAVA/Cyclesort.java b/JAVA/Cyclesort.java new file mode 100644 index 0000000..74c44ec --- /dev/null +++ b/JAVA/Cyclesort.java @@ -0,0 +1,27 @@ +// Online Java Compiler +// Use this editor to write, compile and run your Java code online +import java.util.Arrays; + +class Cyclesort{ + public static void main(String[] args) { + int[] arr={3,5,2,1,4}; + cyclicsort(arr); + System.out.println(Arrays.toString(arr)); + } + static void cyclicsort(int[] arr){ + int i=0; + while(i