Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using C++, design and implement an ordered linked list class. This class should be a template.The class should have the following methods fully implemented. Constructor

Using C++, design and implement an ordered linked list class. This class should be a template.The class should have the following methods fully implemented.

Constructor

AddItem adds an item from the list

GetItem searches the list for the given item. If found, it removes it from the list and returns it. If not found, it returns a null pointer.

IsInlist returns a bool indicating if the given item is in the list.

IsEmpty returns a bool indicating if the list is empty.

Size returns an int indicating the number of items in the list.

SeeNext returns the item without removing it from the list at a given location in the list. The class will maintain the next location and will start at the first item in the list. When it gets to the last item in the list, it will return a null pointer after it gets past the last item. If the list is empty, this will throw an error. 2 calls to SeeNext will return the 2 items next to each other in the list unless SeeAt or Reset is called in between the 2 calls (or the first call returns the last item in the list).

SeeAt Finds an item at a location in the list (int passed in from user), and returns the item without removing it. If the location passed by the user is past the end of the list, this will throw an error. This will set the location used by SeeNext to point at the item after the item returned.

Reset resets the location that the SeeNext function uses to point at the first item in the list.

Destructor

All items passed to or from the class should be done so via a pointer rather than by value.

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

Principles Of Multimedia Database Systems

Authors: V.S. Subrahmanian

1st Edition

1558604669, 978-1558604667

More Books

Students also viewed these Databases questions