Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#include #include typedef struct node{ int key; struct node* next; } node_t; typedef node_t* node_ptr; void main() { node_ptr p = NULL; node_ptr listhead =

image text in transcribed

#include

#include

typedef struct node{

int key;

struct node* next;

} node_t;

typedef node_t* node_ptr;

void main()

{

node_ptr p = NULL;

node_ptr listhead = NULL;

/**

* FILL THE GAP:

* Create a listhead with key = 1,2,3,...,10

* Make sure next pointer is pointing to the

* next node

*/

/**

* FILL THE GAP:

* Delete node with key 5 6 and 7 in that order

*/

/**

* FILL THE GAP:

* Insert a new node with key 6

*/

/**

* Traverse the list and print the key

*/

p = listhead;

if(p==NULL)

{

printf("List empty ");

return;

}

/* traverse and print key */

while( p->next !=NULL)

{

printf("%d ", p->key);

p = p->next;

}

printf("%d ",p->key);

}

Your Code 1 #include #include 4 typedef struct node int key; struct node* next; 7 node.t; 9 typedef node_t* node_ptr; 10 11 void mainO 12- 13 14 15 16 17 18 19 20 21 node_ptr p NULL; node_ptr listhead NULL; FILL THE GAP * Create a listhead with key 1,2,3, , 10 Make sure next pointer is pointing to the * next node 23 24 25 26 27 28 29 30 31 32 FILL THE GAP * Delete node with key 5 6 and 7 in that order k* FILL THE GAP: *Insert a new node with key 6 34 35 36 38 39 40 41 42 * Traverse the list and print the key pisthead; if(p=-NULL) 44 45 46 47 48 49 50 51 52 53 54 printf("List empty "; return; /* traverse and print key whileC p->next !-NULL) printf("%d ", P -p->next; p->key); printf("%d " , p->key) ; 56 57

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

Securing SQL Server Protecting Your Database From Attackers

Authors: Denny Cherry

1st Edition

1597496251, 978-1597496254

Students also viewed these Databases questions

Question

5. What information would the team members need?

Answered: 1 week ago