more successors. The major advantage of the liniked ist over the array is that data are casily Inserted and deleted 1) The following programs can be used for self-studying for linked list insertion sort operation: #includecstdlib.h> #include #include #define NULL O struct node char info[10]; struct node *n; void main(void) { typedef struct node NODEPTR; char a[10]; int cnt-0; NODEPTR x, y, save, head, p, 9: x= NODEPTR)malloc(sizeof(struct node)); y = NODEPTR)malloc(sizeof(struct node); head=x; x->n=y, y-n=NULL; strepy(x->info,"cemal"); strepy(y->info,"mert"); do puts("Enter Name information"); gets(a); cnt++; q=NULL; for(p=head; p!=NULL && stremp(a,p->info)>0; p=p->n) if (q ==NULL) {

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

can you please do it on dev c++ , it's C programming

Linked List
REMINDER:
-Alniced list ls a dynamic data structure,
- The pointer to a iniked llst - that is, the pointer to the first node in the llst - Is stored in a separate
location.
-A(singly) Ilnksd list is traversed In onty one directon,
- LUnked lsts are collections ot data items "llned up In a row - Insertions and removals are made
anywhere in a linked list.
- The dynamic nature of a list may be contrasted with the static nature of an array, whose size
remains constant
- Linked lists are Important not only as a means of Implementing stacies and queues but as data
structures in their own right,
- An Item is accessed In a linioed Ilst by traversing the list from its beginning (5,10.15.
- We can use a linked Ilst to create linsar and non-linear structures. In Iinsar Ilniked sts, sach
element has only zero or one successor. In nonHlincar ists, sach element can have zero, one, or
more successors. The major advantage of the linked ist over the array is that data are easlly
Inserted and deleted
1) The following programs can be used for self-studying for linked list insertion
sort operation:
#includecstdlib.h>
#include <stdio.h>
#include <string.h>
#define NULL O
struct node
char info[10]:
struct node *n;
void main(void)
{
typedef struct node *NODEPTR;
char a[10];
int cnt=0;
NODEPTR x, y, save, head, p , 9
x= NODEPTR)malloc(sizeof(struct node));
y = NODEPTR)malloc(sizeof(struct node));
head=x;
x->n=y,
y-n=NULL;
strepy(x->info,"cemal");
strepy(y->info,"mert");
do
{
puts("Enter Name information");
gets(a);
cnt++;
q=NULL;
for(p=head; p!=NULL && strcmp(a.p->info)>0; p=p->n)
q=p;
if (q ==NULL) {
Transcribed Image Text:Linked List REMINDER: -Alniced list ls a dynamic data structure, - The pointer to a iniked llst - that is, the pointer to the first node in the llst - Is stored in a separate location. -A(singly) Ilnksd list is traversed In onty one directon, - LUnked lsts are collections ot data items "llned up In a row - Insertions and removals are made anywhere in a linked list. - The dynamic nature of a list may be contrasted with the static nature of an array, whose size remains constant - Linked lists are Important not only as a means of Implementing stacies and queues but as data structures in their own right, - An Item is accessed In a linioed Ilst by traversing the list from its beginning (5,10.15. - We can use a linked Ilst to create linsar and non-linear structures. In Iinsar Ilniked sts, sach element has only zero or one successor. In nonHlincar ists, sach element can have zero, one, or more successors. The major advantage of the linked ist over the array is that data are easlly Inserted and deleted 1) The following programs can be used for self-studying for linked list insertion sort operation: #includecstdlib.h> #include <stdio.h> #include <string.h> #define NULL O struct node char info[10]: struct node *n; void main(void) { typedef struct node *NODEPTR; char a[10]; int cnt=0; NODEPTR x, y, save, head, p , 9 x= NODEPTR)malloc(sizeof(struct node)); y = NODEPTR)malloc(sizeof(struct node)); head=x; x->n=y, y-n=NULL; strepy(x->info,"cemal"); strepy(y->info,"mert"); do { puts("Enter Name information"); gets(a); cnt++; q=NULL; for(p=head; p!=NULL && strcmp(a.p->info)>0; p=p->n) q=p; if (q ==NULL) {
q=NULL;
for(p=head; p!=NULL && stromp(a.p->info)>0; p=p->n)
if (q ==NULL) {
p=NODEPTR)malloc(sizeof(struct node));
strepy(p->info,a);
p->n = head;
head=p;
else
{
save-p;
p=NODEPTR)malloc(sizeof(struct node);
strepy(p->info,a);
p-n=save;
}wh
for(save=head;savel=NULL;save=save-n)
printf"Traverse Node =%s'n",save->info);
getchar);
}
2) Do some modification in the program that will create the linked list in descending
order and list the output.
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.
Transcribed Image Text:q=NULL; for(p=head; p!=NULL && stromp(a.p->info)>0; p=p->n) if (q ==NULL) { p=NODEPTR)malloc(sizeof(struct node)); strepy(p->info,a); p->n = head; head=p; else { save-p; p=NODEPTR)malloc(sizeof(struct node); strepy(p->info,a); p-n=save; }wh for(save=head;savel=NULL;save=save-n) printf"Traverse Node =%s'n",save->info); getchar); } 2) Do some modification in the program that will create the linked list in descending order and list the output. 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.
Expert Solution
steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY