continued HOW MANY PERMUTATION EXIST?
| 1 | 2 | 3 | 4 | |
|---|---|---|---|---|
| 1 | ♛ | |||
| 2 | ♛ | |||
| 3 | ♛ | |||
| 4 | ♛ |
test : Q1 : N Q2 : N-1 Q3 : N-3 Q4 : 1
not considering diagonal eliments in table above and is just general soln how our solution can be obtained
Worst case Time complexity : O(N!)
| 1 | 2 | 3 | 4 | |
|---|---|---|---|---|
| 1 | ♛ | |||
| 2 | ♛ | |||
| 3 | ♛ | |||
| 4 | ♛ |
Best case time complexity : O(n) at every row very first trial of column is sucessful It is linear time in number of rows
graph coloring refers to the problem of coloring vertices of a graph in such a way that no two adjacent vertices have same color
minimum number of colors needed to color a graph is called its chromatic number

set={R,G,B}
Possible Solutions : 3^4 ( no of colors ^ no of vertices )
BACKTRACKING : STATE SPACE TREE
graph TD
A --RED--> B
B--RED--> NoSoln1
B--GREEN--> C
C--RED-->D
D--RED--> NoSoln2
D --GREEN--> Soln1
D--BLUE-->Soln2