Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

SQL Instant Reference

Authors: Gruber, Martin Gruber

2nd Edition

0782125395, 9780782125399

More Books

Students also viewed these Databases questions