Skip to content

Commit f34439d

Browse files
Update ReverseQueueRecursion.java
1 parent e8e5fc3 commit f34439d

File tree

1 file changed

+0
-15
lines changed

1 file changed

+0
-15
lines changed

src/main/java/com/thealgorithms/datastructures/queues/ReverseQueueRecursion.java

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,12 @@
11
package com.thealgorithms.datastructures.queues;
2-
32
import java.util.Queue;
4-
5-
/**
6-
* Reverse a queue using recursion.
7-
*/
83
public final class ReverseQueueRecursion {
9-
104
private ReverseQueueRecursion() {
11-
// private constructor to prevent instantiation
125
}
13-
14-
/**
15-
* Reverses the given queue recursively.
16-
*
17-
* @param queue the queue to reverse
18-
* @param <T> the type of elements in the queue
19-
*/
206
public static <T> void reverseQueue(final Queue<T> queue) {
217
if (queue == null || queue.isEmpty()) {
228
return;
239
}
24-
2510
final T front = queue.poll();
2611
reverseQueue(queue);
2712
queue.add(front);

0 commit comments

Comments
 (0)