From 1080b37bbe40fe56b919d22804c159cccdca3c95 Mon Sep 17 00:00:00 2001 From: bd-912 Date: Wed, 10 Apr 2024 23:40:25 -0600 Subject: Library rename, created A4 directories --- boil/tests/QuickSort.java | 112 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 boil/tests/QuickSort.java (limited to 'boil/tests/QuickSort.java') diff --git a/boil/tests/QuickSort.java b/boil/tests/QuickSort.java new file mode 100644 index 0000000..5893390 --- /dev/null +++ b/boil/tests/QuickSort.java @@ -0,0 +1,112 @@ +class QuickSort{ + public static void main(String[] a){ + System.out.println(new QS().Start(10)); + } +} + + +// This class contains the array of integers and +// methods to initialize, print and sort the array +// using Quicksort +class QS{ + + int[] number ; + int size ; + + // Invoke the Initialization, Sort and Printing + // Methods + public int Start(int sz){ + int aux01 ; + aux01 = this.Init(sz); + aux01 = this.Print(); + System.out.println(9999); + aux01 = size - 1 ; + aux01 = this.Sort(0,aux01); + aux01 = this.Print(); + return 0 ; + } + + + // Sort array of integers using Quicksort method + public int Sort(int left, int right){ + int v ; + int i ; + int j ; + int nt; + int t ; + boolean cont01; + boolean cont02; + int aux03 ; + t = 0 ; + if (left < right){ + v = number[right] ; + i = left - 1 ; + j = right ; + cont01 = true ; + while (cont01){ + cont02 = true ; + while (cont02){ + i = i + 1 ; + aux03 = number[i] ; + if (!(aux03