Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

answer in C code please Suppose we have a linked list implemented with the structure below. Write a function that will take in pointer to

answer in C code please
image text in transcribed
image text in transcribed
Suppose we have a linked list implemented with the structure below. Write a function that will take in pointer to the head of a list and inserts a node storing 1 after each even value in the list. If the list is empty or there are no even values in the list, no modifications should be made to the list. (For example if the initial list had 2,6,7,1,3, and 8 , the resulting list would have 2,1,6,1,7,1,8,1.) typedef struct node \{ int data; struct node* next; \} node; void markEven(node* head) \{ \} void deallocateList(node** head) \{ node tmp = *head; while (tmp != NULL) \{ "head = tmp->next; free(tmp); tmp= "head; \} "head = NULL; \} int insertlist(node** head, int data) \{ node newNode =( node ) malloc(sizeof(node)); if (newNode == NULL) return-1; newNode > data = data; newNode->next = NULL; newNode->next = "head; "head = newNode; return 1; \}

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2016 Riva Del Garda Italy September 19 23 2016 Proceedings Part 1 Lnai 9851

Authors: Paolo Frasconi ,Niels Landwehr ,Giuseppe Manco ,Jilles Vreeken

1st Edition

3319461273, 978-3319461274

More Books

Students also viewed these Databases questions