Skip to content

Commit 0bb5df0

Browse files
authored
Update PriorityQueueSort.java
1 parent 4dbdad1 commit 0bb5df0

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

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

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,22 @@
55
/**
66
* Sorts an array using Java's PriorityQueue (Min-Heap).
77
*
8-
* <p>Example:
9-
* Input: [7, 2, 9, 4, 1]
10-
* Output: [1, 2, 4, 7, 9]
8+
* <p>Example: Input: [7, 2, 9, 4, 1] Output: [1, 2, 4, 7, 9]
119
*
1210
* <p>Time Complexity:
1311
* - Inserting n elements into the PriorityQueue → O(n log n)
1412
* - Polling n elements → O(n log n)
1513
* - Total: O(n log n)
1614
*
17-
* Space Complexity: O(n) for the PriorityQueue
15+
* <p>Space Complexity: O(n) for the PriorityQueue
1816
*
19-
* @see <a href="https://en.wikipedia.org/wiki/Heap_(data_structure)">Heap / PriorityQueue</a>
17+
* @see <a href="https://en.wikipedia.org/wiki/Heap_(data_structure)">
18+
* Heap / PriorityQueue</a>
2019
*/
2120
public final class PriorityQueueSort {
2221

2322
// Private constructor to prevent instantiation (utility class)
24-
private PriorityQueueSort() {
25-
}
23+
private PriorityQueueSort() {}
2624

2725
/**
2826
* Sorts the given array in ascending order using a PriorityQueue.

0 commit comments

Comments
 (0)