#include <iostream>
using namespace std;
// A to C using B
void TOH(int n, char A, char B, char C)
{
if(n==0) {
return;
}
TOH(n-1, A, C,B);
cout << A << " to " << C<< endl;
TOH(n-1, B, A,C);
}
int main()
{
TOH(3, 'A', 'B', 'C');
return 0;
}
#include <iostream> using namespace std; struct Node { int data; Node* next; }; class Stack { Node* top; public: Stac...
No comments:
Post a Comment