Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

specially want answer for question iv(language c only) Actually want answer specially for part vi Question 1 (25 marks) #include #include struct Node { int

specially want answer for question iv(language c only) image text in transcribed
image text in transcribed
image text in transcribed
Actually want answer specially for part vi
Question 1 (25 marks) #include #include struct Node { int data; struct Node* next; void insertAtFrontOfLinkedList(struct Node** head_ref, int new_data) { struct Node"new_node = (struct Node)malloc(sizeof(struct Node)); new_node->data-new_data; new_node->next =("head_ref); ("head_ref) = new_node; } void insertAfterANode(struct Node previous fade, int data) { struct Node* new_node = (struct Node)malloc(sizeof(struet Node)); new_node->data = data: new_node->next = previous_node->next; previous_node->next = new_node; } void insertAtBackOfLinkedList(struct Node** ptr, int data) { struct Node new_node = (struct Node)malloc(sizeof(struct Node)); struct Node list"ptr, new_node->data-data; new_node->next = NULL; = while (list->next = NULL) list-list->next; list->next = new_node; 3 void deleteNode(struct Node** head_ref, int key) { struct Node temp ="head_ref"pres prev=NULL; if (temp = NULL && temp-datakey) { "head_ref-temp-Sne; free temp); return; while (temp = NULL && temp->data -key). prev=temp temp-temp-Sneat 3 if(temp NULL) Tetum; prevnext = temp->next free(temp): void printi.inkedList(struct Nodet per) { while(ptr - NULL) printf("%dit", ptr->data) ptr = ptr->next; Algorithm Q1 is a program to insert and delete a linked list. Consider the linked list in Figure Q1, using Algorithm Q1: head 3 NULL Figure Q1 Write a function call to display the linked list (2 marks) Write a function call to insert a new node after node 5 from Figure Q10 The new node has data - 10 (2 marks) a 111 . iv. Visualize the linked list after the new nod insertion in Q1(iii). (2 marks) Write a function call to insert a new node after node 2 from Figure Q10. The new node has data = 20. (2 marks) Visualize the linked list after the new node insertion in Q1(v). (2 marks) Write a main() function that will create the linked list in Figure Q1(1). Give three (3) possible solutions. (15 marks) V. vi

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

Database Systems An Application Oriented Approach Complete Version

Authors: Michael Kifer, Arthur Bernstein, Richard Lewis

2nd Edition

0321268458, 978-0321268457

More Books

Students also viewed these Databases questions

Question

Explain the nature of human resource management.

Answered: 1 week ago

Question

Write a note on Quality circles.

Answered: 1 week ago

Question

Describe how to measure the quality of work life.

Answered: 1 week ago

Question

Explain the function and purpose of the Job Level Table.

Answered: 1 week ago