Question: in c++ Given the definition for a node in a linked list, struct node { int data; node *next; Use this prototype node* aca_sublist (node

Given the definition for a node in a linked list, struct node { int data; node *next; Use this prototype node* aca_sublist (node *p) to write a function that will remove nodes for the list. It should remove all nodes that are not larger in values than all nodes that came before it. acs_sublist must be a destructive function meaning that no new nodes are allocated and the original list p cannot be reconstructed. Your solution needs to recursive. Examples if p points to the linked list [ 1 5 3 4 7 3 4 1 11 12 13 2 100 11 then p should be [ 1 5 7 11 12 13 100) if p points to the linked list 16 14 18 1 then p should be [ 6 14 181 if p points to the linked list [ 10 1 2 3 4 5 6 7 ) then p should be 101 . to write a function that will remove nodes for the list. It should remove all nodes that are not larger in values than all nodes that came before it. acs sublist must be a destructive function meaning that no new nodes are allocated and the original list p cannot be reconstructed. Your solution needs to recursive. Examples if p points to the linked list [ 15 3 4 7 3 4 1 11 12 13 2 100 11 then p should be [ 1 5 7 11 12 13 1001 if p points to the linked list [ 6 14 18 ) then p should be [ 6 14 181. if p points to the linked list ( 10 1 2 3 4 5 6 7 ) then p should be 10). Should be call like this h=ace_sublist(h) Do not use arrays. Do not use vectors. Do not strings. Do not use globals. Do not use static variables. Do not use the STL
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
