Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

in c++ image text in transcribed
image text in transcribed
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

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

More Books

Students also viewed these Databases questions