Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

//give the output of the following program and draw the link list. struct node{ int info; struct node *link; }; typedef struct node *nodePTR; void

//give the output of the following program and draw the link list.

struct node{ int info; struct node *link; }; typedef struct node *nodePTR; void insort(nodePTR*,struct Info); nodePTR getnode(); int main(void) { nodePTR p=NULL,head=NULL,save; inti;

for(i=0;i<3;i++) { insort (&head,i+5); } save=head; do{ printf("%d",save->info); save=save->link; }while(save!=NULL);

return0; } nodePTR getnode() { nodePTR q; q=(nodePTR)malloc(sizeof(struct node)); return q; } void insort(NODEPTR *head , int x) { NODEPTR p,q,r; q=NULL; for(p=*head; p!=NULL &&x>p->info; p=p->link) q=p; if(q=NULL) { p=getnode(); p->info=x; p->link=head; head=p; } else { r=getnode(); q->link=r; r->info=x; r->link=p; } }

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

Recommended Textbook for

Records And Database Management

Authors: Jeffrey R Stewart Ed D, Judith S Greene, Judith A Hickey

4th Edition

0070614741, 9780070614741

More Books

Students also viewed these Databases questions

Question

12.6 Analyze the emerging emphasis on employee recognition.

Answered: 1 week ago