# include <stdio.h>
# include <conio.h>
# include <stdlib.h>
struct list
{
int number;
struct list *next;
};
typedef struct list node;
node *first,*prev,*temp,*curr;
void create(void)
{
printf("\n Stop by -999");
temp=(node *)(malloc(sizeof(node)));
printf("\n Enter the numbers ");
scanf("%d",&temp->number);
while(temp->number!=-999)
{
temp->next=NULL;
if(first==NULL)
{
first=temp;
prev=first;
}
else
{
prev->next=temp;
prev=temp;
}
temp=(node *)(malloc(sizeof(node)));
scanf("%d",&temp->number);
} //end of while
}
void delete1(void)
{
int num;
printf("\nEnter the number to delete ");
scanf("%d",&num);
if(first->number==num)
{
first=first->next;
return;
}
else
{
prev=first;
curr=first->next;
while(curr->next!=NULL)
{
if(curr->number==num)
{
prev->next=curr->next;
return;
}
prev=curr;
curr=curr->next;
}
}
if(curr->number==num)
{
prev->next=NULL;
return;
}
printf("\n No such number");
}
void insertbefore(void)
{
int nu;
temp=(node *)(malloc(sizeof(node)));
printf("\n Enter the number ");
scanf("%d",&temp->number);
printf("\n Insert before which number ");
scanf("%d",&nu);
temp->next=NULL;
prev=first;
curr=first;
if(first==NULL) //if the list is empty then we can insert in this
way
{
first=temp;
return;
}
if(curr->number==nu)
{
temp->next=first;
first=temp;
return;
}
else
{
prev=curr;
curr=curr->next;
while(curr->next!=NULL)
{
if(curr->number==nu)
{
prev->next=temp;
temp->next=curr;
return;
}
prev=curr;
curr=curr->next;
}
}
if(curr->number==nu)
{
prev->next=temp;
temp->next=curr;
return;
}
printf("\n No such number ");
}
void insertafter(void)
{
int nu;
temp=(node *)(malloc(sizeof(node)));
printf("\n Enter the number ");
scanf("%d",&temp->number);
printf("\n Insert after which number ");
scanf("%d",&nu);
temp->next=NULL;
prev=first;
curr=first;
if(first==NULL) //if the list is empty then we can insert in this
way
{
first=temp;
return;
}
if(curr->number==nu)
{
temp->next=curr->next;
curr->next=temp;
return;
}
else
{
prev=curr;
curr=curr->next;
while(curr->next!=NULL)
{
if(curr->number==nu)
{
temp->next=curr->next;
curr->next=temp;
return;
}
prev=curr;
curr=curr->next;
}
}
if(curr->number==nu)
{
curr->next=temp;
return;
}
printf("\n No such number ");
}
void print(void)
{
printf("\n The list is \n");
printf(" -----------\n");
temp=first;
while(temp!=NULL)
{
printf("%d-->",temp->number);
temp=temp->next;
}
printf("Nil");
getch();
}
void main()
{
int ch=0;
first=NULL;
clrscr();
printf("\n Linked List creation \n");
create();
clrscr();
while(ch!=5)
{
clrscr();
printf("\n 1.Insert Before");
printf("\n 2.Insert After");
printf("\n 3.Delete ");
printf("\n 4.Print ");
printf("\n 5.Exit ");
printf("\n Enter your choice ");
scanf("%d",&ch);
switch(ch)
{
case 1:
insertbefore();
print();
break;
case 2:
insertafter();
print();
break;
case 3:
delete1();
print();
break;
case 4:
print();
break;
case 5:
print();
exit(1);
}
}
getch();
}
Java programming course use java import. Follow instructions and comments to explain the code tha...
the language is java if you coukd shiwnstep by step on how to get each section ebapps/blackboard/execute/content/file?cmd-view&content jid _975287 1&course id:_693311 Lab 3 Directions (linked lists) Program #1 1. Show PolynomialADT interface 2. Create the PolyNodeClass with the following methods: default constructor, . overloaded constructor, copy constructor, setCoefficient, setExponent, setNext, getCoefficient, getExponent, getNext 3. Create the PolynomialDataStrucClass with the following methods: defaut constructor, overloaded constructor, copy constructor, isEmpty. setFirstNode. getfirstNode,addPolyNodeFirst (PolyNode is created and set to the end of polynomial),...
Java basic programming course simple as possible use java import and comments to explain the code thanks in advance Preezing and Bolling Points The following cable lisrs the freezing and boiling points of several substanices. Substance Ethyl Alcohol Oxygen -173 -362 32 Boiling Point 172 -306 212 ter Design a class that stores a temperature in a temperature field and has the appropriate accessor and mutator methods for the field. In addition to appropriate constructors, the class should have the...