Skip to content

Commit 026f27a

Browse files
Nikhilesh SatishNikhilesh Satish
authored andcommitted
Added Tower of Hanoi recursive algorithm and a sample test case
1 parent 4eab717 commit 026f27a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main/java/com/thealgorithms/recursion/TowerOfHanoi.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
/*Tower of Hanoi Problem on Wikipedia - https://en.wikipedia.org/wiki/Tower_of_Hanoi */
44

5-
public class TowerOfHanoi {
6-
5+
public final class TowerOfHanoi {
6+
private TowerOfHanoi(){}
77
public static void solveHanoi(int n, char src, char dest, char aux) {
88
if (n == 1) {
99
System.out.println("Move disk 1 from " + src + " to " + dest);

0 commit comments

Comments
 (0)