Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Q.Answer the following questions regarding (noncircular) doublylinked lists implemented using the Node struct definition as given in file dnode.h. Assume that T has been defined

Q.Answer the following questions regarding (noncircular) doublylinked lists implemented using the Node struct definition as given in file dnode.h. Assume that T has been defined and use it wherever the list element type is needed. Note: you are not required to implement these functions in a program that runs, but you can if you want to.

1. (6 points) Write a function is_ascending that receives the head (node) pointer of a doublylinked list and returns true if the items are in strictly ascending order (compared using operator<); false otherwise.

2. (7 points) Write a function remove_duplicates that receives the head (node) pointer of a doublylinked list and removes any duplicates in the list. This can be done by having one scanning pointer that is used to scan the list and for each item, use another scanning pointer that is used to look for duplicates (as defined by operator==) starting with the next item.

3. (7 points) Write a function split_list that receives a head (node) pointer of a doublylinked list and a target data value, and passes back the head pointers for two new doublylinked lists. The first list will contain copies of the items that are less than the target value (compared using operator<) in the same order as they are given in the source list, and the second list will contain copies of all other items (i.e., those greater than or equal to the target value) in the same order as they are given in the source list.

Note that the source list is not in any particular order, and the source list should not be modified by this function

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

Data Infrastructure For Medical Research In Databases

Authors: Thomas Heinis ,Anastasia Ailamaki

1st Edition

1680833480, 978-1680833485

More Books

Students also viewed these Databases questions