You are on page 1of 19

1. Explain Branch and Bound Technique in brief.

https://youtu.be/XZbrmetb9VE?si=JioRRa7zpGkaq2uL
2. Explain use of Branch & Bound Technique for solving Assignment Problem.
https://youtu.be/0F1uPOGCFxg?si=OzWPU_tY7thQ3wWn
3. Explain Minimax principle with its use.
https://youtu.be/Ntu8nNBL28o?si=X3TlEkNktoj5gEG7
4. Give the algorithm to solve the Tower of Hanoi Problem. Comment on the
complexity of the algorithm.
https://youtu.be/q6RicK1FCUs?si=3NpM-IkjmgWd_412
5. What is Recursion? Give the implementation of the Tower of Hanoi problem using
Recursion.

Recursion is a programming technique in which a function calls itself in order to solve a problem.
It is widely used in programming to solve complex problems that can be broken down into
smaller, simpler ones.
In the context of the Tower of Hanoi problem, recursion is used to solve the puzzle of moving a
stack of disks from one peg to another, while following the rules that no larger disk can be placed
on top of a smaller one.

https://youtu.be/NSZ1fOWZAcY?si=I2wLqFuHANY0XP2f

implementation of the Tower of Hanoi problem using Recursion.

#include <stdio.h>

// Tower of Hanoi program in C using Recursion


void toH(int n, char rodA, char rodC, char rodB)
{
if (n == 1)
{
printf("\n Move disk 1 from rod %c to rod %c",rodA ,rodC );
return;
}
toH(n-1, rodA, rodB, rodC);
printf("\n Move disk %d from rod %c to rod %c", n, rodA, rodC);
toH(n-1, rodB, rodC,rodA);
}

int main()
{
int no_of_disks ;
printf("Enter number of disks: ");
scanf("%d", &no_of_disks);
toH(no_of_disks, 'A','C','B');
return 0;
}

Enter the number of disks: 4


Move disk 1 from rod A to rod B
Move disk 2 from rod A to rod C
Move disk 1 from rod B to rod C
Move disk 3 from rod A to rod B
Move disk 1 from rod C to rod A
Move disk 2 from rod C to rod B
Move disk 1 from rod A to rod B
Move disk 4 from rod A to rod C
Move disk 1 from rod B to rod C
Move disk 2 from rod B to rod A
Move disk 1 from rod C to rod A
Move disk 3 from rod B to rod C
Move disk 1 from rod A to rod B
Move disk 2 from rod A to rod C
Move disk 1 from rod B to rod C

6. Explain Backtracking Method. What is the N-Queens Problem?


The N-Queens Problem is a chess puzzle that asks how to place N queens on an
NxN chessboard so that no two queens can attack each other. This means that no
two queens can be on the same row, column, or diagonal.

The N-Queens Problem is over 150 years old.

7. Explain the use of Backtracking method for solving Eight Queens Problem giving
its algorithm.
https://youtu.be/M8SS5pgDck4?si=afIO1aPbnzKtLBvz
https://youtu.be/Cc4mqUNig-c?si=lA3U4wYZ2al_BY_N
8. Explain Backtracking with Knapsack problem.
https://youtu.be/Mcs6kpMRXBM?si=GWur84ObX_NJq_WG

9. Explain with example how a backtracking algorithm is useful in solving a


Hamiltonian cycle problem.
https://youtu.be/9AIUTe4IkD0?si=zxiSS039C8nLiD3I

Numerical/Derivable
1. Give solution to 4- Queens Problem using Backtracking Method.
2. Find all possible solution for the 4*4 chess boards, 4 queen’s problems using
backtracking.

3. Find an optimal solution to the knapsack instance n=4, M=8,


(P1,P2,P3,P4)=(3,5,6,10) and (W1,W2,W3,W4)=(2,3,4,5) using backtracking. Also draw
the corresponding state space tree.

You might also like