Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2 ) The following programs can be used for self-studying for linked list insertion sort operation: #include #include #include #define NULL 0 struct node {

2) The following programs can be used for self-studying for linked list insertion sortoperation:

#include

#include

#include

#define NULL 0

struct node

{

char info[10];

struct node *n;// link field

};

int main(void)

{

typedef struct node *NODEPTR;

char a[10];

int cnt=0;

NODEPTR x , y , save , head , p , q;

x = (NODEPTR)malloc(sizeof(struct node));

y = (NODEPTR)malloc(sizeof(struct node));

head = x;

x->n = y;

y->n = NULL;

strcpy(x->info,"cemal");

strcpy(y->info,"mert");

do

{

puts("Enter Name information(Using lover case character)");

gets(a);

cnt++;

q = NULL;

for(p = head; p != NULL && strcmp(a, p->info)>0; p = p->n)

q = p;

if (q == NULL) {

p=(NODEPTR)malloc(sizeof(struct node));

strcpy(p->info,a);

p->n = head;

head = p;

}

else

{

save=p;

p = (NODEPTR)malloc(sizeof(struct node));

strcpy(p->info,a);

p->n = save;

q->n = p;

}

}while (cnt!=3);

for(save = head;save != NULL;save = save->n)

printf("Traverse Node =%s ",save->info);

getchar();

}

3)Complete above program in a way that will delete any given person(name will be taken from the keyboard) from the linked list structure. List content of linked list after deletion.

Note: Give error message if the given person is not in the linked list.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Sidestep common tone and grammar problems

Answered: 1 week ago

Question

6. Discuss the steps involved in conducting a task analysis.

Answered: 1 week ago

Question

8. Explain competency models and the process used to develop them.

Answered: 1 week ago