
26th December 2007, 10:44 AM
|
|
Junior Member
|
|
Join Date: Dec 2007
Posts: 1
Credits: 0
|
|
I want a C Program which solves the Tower of Hanoi Problem with only one recursive
call? The tower of hanoi problem has many solutions of these in some recursive solutions, the recursive function is called more than once. I want a C program with only one call to the recursive function which solves the problem. I want the C source code.YOU CAN NOTICE TWO CALLS to the recursive function "transfer()". there should be only one..ie., only once it should be called in the functionvoid transfer(int n,char from[],char to[],char temp[]){if(n>0){transfer(n-1,from,temp,to);printf("Move disc %d from %s to %s\n",n,from,to);transfer(n-1,temp,to,from);}return;}
|