Skip to content

Commit c620709

Browse files
committed
initial commit.
1 parent 3e75e73 commit c620709

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

src/main/java/com/thealgorithms/sorts/SleepSort.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.thealgorithms.sorts;
22

3-
/**
3+
/*
44
* @author Aiswarya PM (https://github.com/aishuarya)
55
* The SleepSort class demonstrates the Sleep Sort algorithm.
66
* Sleep Sort is a sorting algorithm that works by leveraging the concurrency of threads.
@@ -17,16 +17,16 @@
1717
import java.util.ArrayList;
1818
import java.util.Collections;
1919

20-
public class SleepSort {
20+
class SleepSort {
2121

2222
public static void sleepSort(ArrayList<Integer> array) {
2323
ArrayList<Thread> threads = new ArrayList<>();
2424

2525
for (int numbers : array) {
2626
Thread thread = new Thread(() -> {
2727
try {
28-
Thread.sleep(numbers); // Sleep for 'num' milliseconds
29-
System.out.print(numbers + " "); // Print the number after sleeping
28+
Thread.sleep(numbers); // Sleep for 'num' milliseconds
29+
System.out.print(numbers + " "); // Print the number after sleeping
3030
} catch (InterruptedException e) {
3131
e.printStackTrace();
3232
}

src/test/java/com/thealgorithms/sorts/SleepSortTest.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
package com.thealgorithms.sorts;
22

3-
import org.junit.jupiter.api.Test;
3+
import static org.junit.jupiter.api.Assertions.assertEquals;
4+
import static org.junit.jupiter.api.Assertions.assertTrue;
45
import java.io.ByteArrayOutputStream;
56
import java.io.PrintStream;
67
import java.util.ArrayList;
78
import java.util.Collections;
89
import java.util.List;
9-
import static org.junit.jupiter.api.Assertions.assertEquals;
10-
import static org.junit.jupiter.api.Assertions.assertTrue;
11-
10+
import org.junit.jupiter.api.Test;
1211
public class SleepSortTest {
1312

1413
// Method to capture the output of the SleepSort

0 commit comments

Comments
 (0)