• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests

Top | MCQs on Recursion Algorithm with Answers | Question 28

What is the name of below recursive program?

C++
void fun(int n, char from_rod, char to_rod,
				char aux_rod)
{
	if (n == 0) {
		return;
	}
	fun(n - 1, from_rod, aux_rod, to_rod);
	cout << "Move disk " << n << " from rod " << from_rod
		<< " to rod " << to_rod << endl;
	fun(n - 1, aux_rod, to_rod, from_rod);
}

(A)

N Queen Problem

(B)

Tower of Hanoi

(C)

M coloring Problem

(D)

None

Answer

Please comment below if you find anything wrong in the above post
Feeling lost in the world of random DSA topics, wasting time without progress? It's time for a change! Join our DSA course, where we'll guide you on an exciting journey to master DSA efficiently and on schedule.
Ready to dive in? Explore our Free Demo Content and join our DSA course, trusted by over 100,000 geeks!

Last Updated :
Share your thoughts in the comments