Princeton1/clients/src/main/java/com/hithomelabs/clients/module5/ShellClient.java
hitanshu310 90f8b14ee5
All checks were successful
sample gradle build and test / build (pull_request) Successful in 55s
sample gradle build and test / build (push) Successful in 49s
Mode commonly used objects to a new module common, added dependencies and test dependencies for other modules on common, added Merge sort, client and tests
2025-02-04 02:15:31 +05:30

30 lines
760 B
Java

package com.hithomelabs.clients.module5;
import com.hithomelabs.princeton1.common.Apple;
import com.hithomelabs.princeton1.module5.Shell;
import java.util.Arrays;
import java.util.Random;
public class ShellClient {
public static void main(String[] args) {
int size = 100;
Apple[] apples = new Apple[size];
Shell<Apple> shell = new Shell<Apple>();
for (int i = 0; i < apples.length; i++) {
apples[i] = new Apple(new Random().nextInt(1000));
}
Apple[] applesCopy = Arrays.copyOf(apples, size);
shell.sort(apples);
shell.insertionSort(applesCopy);
//* * Sample output
for (int i = 0; i < apples.length; i++)
System.out.println(apples[i]);
}
}