Question: #include #include // data dataToInsert; new Node->next = NULL; return newNode; else f list is not empty, let's insert at the end print f(inserting element

 #include #include // data dataToInsert; new Node->next = NULL; return newNode;
else f list is not empty, let's insert at the end print
f("inserting element with data %dn-dataTolnsert); Node "current listHead: CAUTION while (current !=

#include #include // data dataToInsert; new Node->next = NULL; return newNode; else f list is not empty, let's insert at the end print f("inserting element with data %dn-dataTolnsert); Node "current listHead: CAUTION while (current != NULL) { if (current->next NULL) // if it's end of list... Node "newNode -malloc(sizeof(Node)) newNode-data data Tolnsert newNode- next-NULL current->next newNode; return listHead; 3 else t otherwise... current- currentnext; void printList(Node listHead) printf"printing list: ") Node "current = lis:Head; while (current!-NULL) printf("%d ""current->data); current -current-next; printf"n"); Node* deleteFirst(Node listHead) t printf"deleting first element from list: In") l TODO: implement return listHead; Node deleteLast(Node listHead) t printf"deleting last element from list: In") TODO: implement Node deleteLast(Node listHead) printf"deleting last element from list: In TODO: implement return listHead; Node deleteSpecific(Node listHead, int data Value)t assume data to delete always exist and is always unique in / this exercise printf( "deleting %d from list in', dataValue); II TODO: implement return listHead; void printBackwardsFromZero(Node listHead) printf printing list in backwards from the first 0 element (or end of list): I TODO: implement. printf"n"): int maino Node myHead NULL; I/head of the linked list, not really MY HEAD myHead insert(myHead, 2000) myHead insert(myHead, 2018); printList(myHead); myHead-insert(myHead, 2001) myHead insert(myHead, 1998); myHead insert(myHead, 0); myHead-insert(myHead, 1999) myHead-insert(myHead, 2021) myHead insert(myHead, 2020) printList(myHead) myHead deleteFirst(myHead) printList(myHead); myHead = deleteastmyHead); printList(myHead); myHead - deleteSpecific(myHead, 1998); printList(myHead): myHead-deleteSpecific(myHead, 2018); printList(myHead); printBackwardsFromZero(myHead) return 0; Problem 1 Please try to implement the unimplemented delete First function in the demo program above as a warmup! The deleteFirst function, as the name suggests, deletes the first element of the list. To do this, simply point the listHead to the second element in the list! You may need to handle the special case of listHead pointing to NULL (i.e. an empty list) If done correctly, your output should look like this: inserting first element with data 2000 inserting element with data 2018 printing list: 2000 2018 inserting element with data 2001 inserting element with data 1998 inserting element with data 0 inserting element with data 1999 inserting element with data 2021 inserting element with data 2020 printing list: 2000 2018 2001 1998 0 1999 2021 2020 deleting first element from list: printing list: 2018 2001 1998 0 1999 2021 2020

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!