Question: This is a c++ program involving Class Templates, Lists, and Nodes. I currently have List.cpp/hpp and Node.cpp/hpp done, Node.cpp/hpp should not need to be changed

This is a c++ program involving Class Templates, Lists, and Nodes. I currently have List.cpp/hpp and Node.cpp/hpp done, Node.cpp/hpp should not need to be changed beyond the new member function.

I need to implement the following member function to List.hpp/cpp:

/** @pre assumes position is valid, if position is > item_count_ it returns an empty List, also assumes that operators = are defined on type T @param position contained in the sorted/increasing (first <= position <= last) sublist to be generated @return a sublist containing the item at position consisting of sorted/ increasing items (first <= position <= last) */

List scanSublist(size_t position);

This function takes a position as parameter, and returns a sublist of the calling List that is sorted in increasing order and it contains the item at position.

For example, if the original list contains integers [3,4,5,6,3,4,5,9,5,4,3,2,5,7,4], a call to scanSublist(5) will return [3,4,5,9], scanSublist(3) will return [3,4,5,6] and scanSublist(9) will return [4].

The goal is to take advantage of the multi-directionality of the doubly-linked list and to produce the sublist by moving backwards and forward from position using the previous_ and next_ pointers.

The link should have the current code

https://shrib.com/#PR2NuQUxLuP1qJFCfYXy

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!