Code:
#include<stdio.h>
#include <string.h>
struct node {
char color[10] ;
char adjustent_countries[17];
char name;
char assigned_colored ; // initally U --> not yet assigned
int MRV; // =0 when the country is colored
struct node *next;
};
void assigned(char country,struct node *head);
//void print(struct node *head);
//void forword_checking( char country,struct node *head);
int main ()
{
//struct node *position;
char assigned_colored ;
///----------------------------------------- create the countries and fill-----------------------------
/// create node A-----------------------------------------------
struct node *A;
A= malloc(sizeof(struct node));
head= malloc(sizeof(struct node));
A->next= "NULL";
A->MRV=4;
A->assigned_colored ='U';
A->name='A';
printf("Node %c\n",A->name);
printf("%c\n ",A->assigned_colored );
printf("%d\n",A->MRV);
// strcpy(A->color,"RGBY");
// A->color[0]='R';
//A->color[1]='G';
//A->color[2]='B';
//A->color[3] = 'Y';
//A->color[4]='\0';
//printf("%s\n",A->color);
strcpy(A->adjustent_countries, "BD\0");
printf("%s\n",A->adjustent_countries);
printf("**************************************************\n");
/// create node B----------------------------------------------
struct node *B;
B= malloc(sizeof(struct node));
A->next=B;
B->next= "NULL";
B->MRV=4;
B->assigned_colored ='U';
B->name='B';
printf("Node %c\n",B->name);
printf("%c\n ",B->assigned_colored );
printf("%d\n",B->MRV);
//strcpy(B->color,"RGBY\0");
// printf("%s\n",B->color);
strcpy(B->adjustent_countries, "CDE\0");
printf("%s\n",B->adjustent_countries);
printf("**************************************************\n");
/// create node C----------------------------------------------
struct node *C;
C= malloc(sizeof(struct node));
B->next=C;
C->next= "NULL";
C->MRV=4;
C->assigned_colored ='U';
C->name='C';
printf("Node %c\n",C->name);
printf("%c\n ",C->assigned_colored );
printf("%d\n",C->MRV);
//strcpy(C->color,"RGBY\0");
//printf("%s\n",C->color);
strcpy(C->adjustent_countries, "EH\0");
printf("%s\n",C->adjustent_countries);
printf("**************************************************\n");
/// create node D----------------------------------------------
struct node *D;
D= malloc(sizeof(struct node));
C->next=D;
D->next= "NULL";
D->MRV=4;
D->assigned_colored ='U';
D->name='D';
printf("Node %c\n",D->name);
printf("%c\n ",D->assigned_colored );
printf("%d\n",D->MRV);
//strcpy(D->color,"RGBY\0");
//printf("%s\n",D->color);
strcpy(D->adjustent_countries, "ABEFGI\0");
printf("%s\n",D->adjustent_countries);
printf("**************************************************\n");
/// create node E----------------------------------------------
struct node *E;
E= malloc(sizeof(struct node));
D->next=E;
E->next= "NULL";
E->MRV=4;
E->assigned_colored ='U';
E->name='E';
printf("Node %c\n",E->name);
printf("%c\n ",E->assigned_colored );
printf("%d\n",E->MRV);
//strcpy(E->color,"RGBY\0");
//printf("%s\n",E->color);
strcpy(E->adjustent_countries, "BCDGH\0");
printf("%s\n",A->adjustent_countries);
printf("**************************************************\n");
/// create node F----------------------------------------------
struct node *F;
F= malloc(sizeof(struct node));
E->next=F;
F->next= "NULL";
F->MRV=4;
F->assigned_colored ='U';
F->name='F';
printf("Node %c\n",F->name);
printf("%c\n ",F->assigned_colored );
printf("%d\n",F->MRV);
//strcpy(F->color,"RGBY\0");
// printf("%s\n",F->color);
strcpy(F->adjustent_countries, "DILO\0");
printf("%s\n",F->adjustent_countries);
printf("**************************************************\n");
/// create node G----------------------------------------------
struct node *G;
G= malloc(sizeof(struct node));
F->next=G;
G->next= "NULL";
G->MRV=4;
G->assigned_colored ='U';
G->name='G';
printf("Node %c\n",G->name);
printf("%c\n ",G->assigned_colored );
printf("%d\n",G->MRV);
//strcpy(G->color,"RGBY\0");
//printf("%s\n",G->color);
strcpy(G->adjustent_countries, "DEHIJK\0");
printf("%s\n",G->adjustent_countries);
printf("**************************************************\n");
/// create node H----------------------------------------------
struct node *H;
H= malloc(sizeof(struct node));
G->next=H;
H->next= "NULL";
H->MRV=4;
H->assigned_colored ='U';
H->name='H';
printf("Node %c\n",H->name);
printf("%c\n ",H->assigned_colored );
printf("%d\n",H->MRV);
//strcpy(H->color,"RGBY\0");
//printf("%s\n",H->color);
strcpy(H->adjustent_countries, "CEGJK\0");
printf("%s\n",H->adjustent_countries);
printf("**************************************************\n");
/// create node I----------------------------------------------
struct node *I;
I= malloc(sizeof(struct node));
H->next=I;
I->next= "NULL";
I->MRV=4;
I->assigned_colored ='U';
I->name='I';
printf("Node %c\n",I->name);
printf("%c\n ",I->assigned_colored );
printf("%d\n",I->MRV);
//strcpy(I->color,"RGBY\0");
//printf("%s\n",I->color);
strcpy(I->adjustent_countries, "DFGJLMO\0");
printf("%s\n",I->adjustent_countries);
printf("**************************************************\n");
/// create node J----------------------------------------------
struct node *J;
J= malloc(sizeof(struct node));
I->next=J;
J->next= "NULL";
J->MRV=4;
J->assigned_colored ='U';
J->name='J';
printf("Node %c\n",J->name);
printf("%c\n ",J->assigned_colored );
printf("%d\n",J->MRV);
//strcpy(J->color,"RGBY\0");
// printf("%s\n",J->color);
strcpy(J->adjustent_countries, "GHIKMPQ\0");
printf("%s\n",J->adjustent_countries);
printf("**************************************************\n");
/// create node K----------------------------------------------
struct node *K;
K= malloc(sizeof(struct node));
J->next=K;
K->next= "NULL";
K->MRV=4;
K->assigned_colored ='U';
K->name='K';
printf("Node %c\n",K->name);
printf("%c\n ",K->assigned_colored );
printf("%d\n",K->MRV);
// strcpy(K->color,"RGBY\0");
//printf("%s\n",K->color);
strcpy(K->adjustent_countries, "GHJNPQ\0");
printf("%s\n",K->adjustent_countries);
printf("**************************************************\n");
/// create node L----------------------------------------------
struct node *L;
L= malloc(sizeof(struct node));
K->next=L;
L->next= "NULL";
L->MRV=4;
L->assigned_colored ='U';
L->name='L';
printf("Node %c\n",L->name);
printf("%c\n ",L->assigned_colored );
printf("%d\n",L->MRV);
//strcpy(L->color,"RGBY\0");
//printf("%s\n",L->color);
strcpy(L->adjustent_countries, "FIO\0");
printf("%s\n",L->adjustent_countries);
printf("**************************************************\n");
/// create node M----------------------------------------------
struct node *M;
M= malloc(sizeof(struct node));
L->next=M;
M->next= "NULL";
M->MRV=4;
M->assigned_colored ='U';
M->name='M';
printf("Node %c\n",M->name);
printf("%c\n ",M->assigned_colored );
printf("%d\n",M->MRV);
//strcpy(M->color,"RGBY\0");
//printf("%s\n",M->color);
strcpy(M->adjustent_countries, "IJOP\0");
printf("%s\n",M->adjustent_countries);
printf("**************************************************\n");
/// create node N----------------------------------------------
struct node *N;
N= malloc(sizeof(struct node));
M->next=N;
N->next= "NULL";
N->MRV=4;
N->assigned_colored ='U';
N->name='N';
printf("Node %c\n",N->name);
printf("%c\n ",N->assigned_colored );
printf("%d\n",N->MRV);
//strcpy(N->color,"RGBY\0");
//printf("%s\n",N->color);
strcpy(N->adjustent_countries, "KQ\0");
printf("%s\n",N->adjustent_countries);
printf("**************************************************\n");
/// create node O----------------------------------------------
struct node *O;
O= malloc(sizeof(struct node));
N->next=O;
O->next= "NULL";
O->MRV=4;
O->assigned_colored ='U';
O->name='O';
printf("Node %c\n",O->name);
printf("%c\n ",O->assigned_colored );
printf("%d\n",O->MRV);
// strcpy(O->color,"RGBY\0");
// printf("%s\n",O->color);
strcpy(O->adjustent_countries, "FILM\0");
printf("%s\n",O->adjustent_countries);
printf("**************************************************\n");
/// create node P----------------------------------------------
struct node *P;
P= malloc(sizeof(struct node));
O->next=P;
P->next= "NULL";
P->MRV=4;
P->assigned_colored ='U';
P->name='P';
printf("Node %c\n",P->name);
printf("%c\n ",P->assigned_colored );
printf("%d\n",P->MRV);
//strcpy(P->color,"RGBY\0");
//printf("%s\n",P->color);
strcpy(P->adjustent_countries, "IJMQ\0");
printf("%s\n",P->adjustent_countries);
printf("**************************************************\n");
/// create node Q----------------------------------------------
struct node *Q;
Q= malloc(sizeof(struct node));
P->next=Q;
Q->next= "NULL";
Q->MRV=4;
Q->assigned_colored ='U';
Q->name='Q';
printf("Node %c\n",Q->name);
printf("%c\n ",Q->assigned_colored );
printf("%d\n",Q->MRV);
// strcpy(Q->color,"RGBY\0");
// printf("%s\n",Q->color);
strcpy(Q->adjustent_countries, "JKNP\0");
printf("%s\n",Q->adjustent_countries);
printf("**************************************************\n");
///----------------------------------------------------------------------///
///---------------------------------------------------------------------
struct node *position;
position=A;
while (position != NULL){
strcpy(position->color,"RGBY\0");
printf(" %s \t %s \t %c \t %c \t %d \n",position->color,position->adjustent_countries,position->name,position->assigned_colored,position->MRV);
position=position->next;}
return 0;
}