N Queens
N Queens
Class 11500123033
1. N-queen problem ..
#include <stdio.h>
#include <stdbool.h>
#include <math.h>
#include <stdlib.h>
int main() {
int n;
printf("Enter the number of queens: ");
scanf("%d", &n);
printf("The possible combinations are:\n");
nQueen(0, n); // Start from row 0
return 0;
}
Out Put....
2. Graph colouring problem
#include <stdio.h>
#include <stdbool.h>
printf("Assigned Colors:\n");
for (int i = 0; i < V; i++)
printf("Vertex %d -> Color %d\n", i, color[i]);
}
int main() {
int graph[V][V] = {
{0, 1, 1, 1},
{1, 0, 1, 0},
{1, 1, 0, 1},
{1, 0, 1, 0}
};
return 0;
}
Output :