Write a menu driven program to implement following operation on singly ordered link list. 1. Insert an element 2. delete an element 3. searching an element 4. display content of list #include #include #include struct node { int info; struct node*link; }*New,*temp,*first,*pred,*save; int x; void insorder(); void display(); void search(); void Delete(); void main() { int ch; clrscr(); first=NULL; while(ch!=5) { printf("\n1.Insorder\n2.Search\n3.Delete\n4.Display\n5.Exit\nEnter your choice :"); scanf("%d",&ch); switch(ch) { case 1: insorder(); break; case 2: search(); break; case 3: Delete(); break; case 4: display(); break; case 5: return; } } getch(); } void insorder() { // Insert The Node In Order printf("Enter the value :"); scanf("%d",&x); New=(struct node*)malloc(sizeof(struct node)); // Size Allocate To The New Pointer New->link=NULL; New->info=x; if(first==NULL) //Check The List Is Empty? { first= New; } save=first; // Initilize Temporary Pointer while((save->link!=NULL)&&(save->link->info)<=(New->info))//Insert The Element In Order { save=save->link; } New->link=save->link; save->link=New; New->link=NULL; } void search() { if(first==NULL) // Check The List Is Empty? { printf("\n* * The List Is Empty * *\n");; } else { printf("\nEnter the no to be search :"); scanf("%d",&x); temp=first; while(temp->info!=x&&temp->link!=NULL) //Find The Node { pred=temp; temp=temp->link; } if(temp->info!=x) // If The Node Not Found { printf("Node Not Found"); } else // Display The Node { printf("\nThe node %d is stored at address of %d",temp->info,temp->link); } } } void display() { if(first==NULL) // Check The List Is Empty? { printf("\n* * The List Is Empty * *\n"); } else { temp=first; printf("\nThe List Is Shown Below\n"); while(temp!=NULL) // Display The List { printf("%d\n",temp->info); temp=temp->link; } } } void Delete() { if(first==NULL) //Check The List Is Empty? { printf("\n* * The list is empty * *\n"); return; } else { printf("\nEnter the no to be delete :"); scanf("%d",&x); temp=first; while(temp->info!=x&&temp->link!=NULL) // Find Node { pred=temp; temp=temp->link; } if(temp->info!=x) // If Node Not Found { printf("Node Not Found"); } if(first->info==x) // Delete The Node { first=first->link; } else { pred->link=temp->link; } } }