1 ) Create a linked list with all the courses(CSIS1000,CSIS1020,CSIS
1.) Create a linked list with all the
courses(CSIS1000,CSIS1020,CSIS1040,CSIS1050,CSIS2030
,CSIS2050,CSIS2060,CSIS2065,FIT1012,FIT
1014,ITEC1020,ENG1030,ENG1020,ENG1021,MATH1020,MA
TH2020,PHY1011,PHY1015) and implement all the
functions (Make sure this name is on the list) Amad
a.) push b.) pop c).dequeue d.)displayinreverse e.)search
(return the index of the location) This is a C prog ram
please type it and then paste it 1.) Create a linked list with
all the courses(CSIS1 20 1014, ITEC
1020,ENG1030,ENG1020,ENG 1021,MATH10 and implement
all the functions (Make sure this name is o the list) Amad
a.) push b. pop c).dequeue d.)displayinreve rse
e.)search(return the index of the location)
Solution
Answer:
#include
#include
#include
void main()
{
struct node
{
int value;
struct node *pointer;
};
typedef struct node NODE;
NODE *up, *begin, *supp = 0;
int count = 0;
int option = 1;
begin = 0;
while (option)
{
up = (NODE *)malloc(sizeof(NODE));
printf(\”Enter the data item\ \”);
scanf(\”%d\”, &up-> value);
if (begin != 0)
{
supp->pointer = up;
supp = up;
}
else
{
begin = supp = up;
}
fflush(stdin);
printf(\”Do you want to continue(Type 0 or 1)? \ \”);
scanf(\”%d\”, &option);
}
supp->pointer = 0;
supp = begin;
printf(\”\ status of the linked list is \ \”);
while (supp != 0)
{
printf(\”%d=>\”, supp->value);
count++;
supp = supp -> pointer;
}
printf(\”NULL\ \”);
printf(\”No. of nodes in the list = %d\ \”, count);
}
Name:
Description:
…