 Hello, welcome to the session Tower of Honeye using recursion. At the end of this session, the student will be able to implement Tower of Honeye program using recursion in C. See the pictures. Do you know what the pictures are about? These are the pictures of Tower of Honeye. You will see what is the Tower of Honeye. Now in the Tower of Honeye, we are having 1, 2, 3, 4 disks like this. There may be any number of disks. Then we are having 3 towers A, B, C. The towers are fixed, only 3 towers are there, but disks may be vary in the numbers. So after that what we have to do? We have to transfer the disk from source to the destination. In this way, while sending from source to destination, the B is the auxiliary, temporary or intermediate tower. Here we can see A is the source tower from where the disk has to be moved, B is the auxiliary tower, temporary we have to take the support of that and C is the destination tower. For this, we are having some rules that the disk can be vary in their number, but we are having only 3 towers and we have to transfer the disk from one tower to another tower. Here one more condition is that only one disk can be moved at a time and you can place a bigger disk over a smaller disk. So this is wrong way. When we are having a single disk, that time we can directly move one disk to the destination disk. If we are having two, then we are having first we have to move first one into the auxiliary, then second one we can move to the final and then first one can be put on that top of the second. So first, second and third, three steps are required in the two disk. When the disk is more, the complications are moved. So for that, we have to go for some algorithm. So in this case, we are having three disks. So first we have moved to the C, then we can move second to the B, first we have moved to the C, then second to the B, then the first disk can be from C to B on the top of the second disk, then third can be moved to the C. By rule, we are doing everything. So here you can see this is the condition. We have moved the nth disk to the destination. Now remaining n minus 1, all the disk we have to move to the final destination. For that, again we have to recursively do the thing. That is here one is moved to the A, then two is moved to the C and again finally we have put one to the C. So these steps has to be followed. One algorithm here we can fix out. That is if we are having A, B, C, rods or tower or pegs, then n are the total number of the disks. Here we can move n minus 1. In this case three disks, we are having two disks move from A to B using auxiliary tower. Then transfer the disk that is the final largest disk three from A to C, then remaining all the disk we have to move from B to C using this A auxiliary tower. So this is the program for the tower of HANAI program. That is we are having function that is tower function. Here we are number of disk, then tower names are there, they are in the characters. In this case we will ask user how many disks are there and accordingly we are calling the function by sending this A, B and C. So here A is source and C is the destination and C, B will be the auxiliary or temporary disk. Now here you can see the program we are sending A, B, C. Here we are calling function A, C, B first and then the first A, B, C will call first A, C, B and then B, A, C. Now we will see how the moves are there, A, B, C will call A, C, B and B, A, C. Again A, C, B will call it is considering A, B, C. Again it will be recursively call this function. You can see here B has shifted to the last and B has shifted to the first. Here the middle C is shifted to the last and C middle shifted to the first place. In this recursive call you can see that is the center part A has shifted to the last and center part A has shifted to the one. So this A, B, C the places are changed but it is considered as A, B, C and accordingly the moves are going to be done. And finally after this recursive calls with this we are getting the all the steps in the sequence. First step it will be you move A to C first then A to B then C to B then A to C then B to A then B to C and then A to C. So this is the sequence finally we are getting with this all call. We can see or we can match it if it is working or not. Now this is our sequence now we will see A, B, C is calling this one and this A, C, B is calling A, B, C. Now how our work will be there? Now first case A is shifting to the C, A is shifting to the C. So this is the first step this is the correct next we are calling this A to B ok we are moving A to B this is also correct one then we are calling C to B whatever the C was there it is moving to the B so here it is C is moving to the B that is the first disk. Then next in the sequence it will be recursively come here after completion of this here it will call whatever the A was there disk that is moving to the C then next in this position again freshly it will call for moving this N-1 disk to the destination or C. So for that again now next we are having we are having call this that is B is moving to A so B is moving to A what was the B? B is here A this disk is moving to the A so after that we are having we have to shift this B tower disk to the C, B tower to the C so it will move to the last one and then finally we have to move this is the A tower first disk to the last tower so it is moving correctly whatever the recursion call are there so accordingly the tower of Hanai works thank you.