Question: For this assignment you will implement an ordered list, OList, class using a singly linked list design. An ordered list keeps its elements in sorted

For this assignment you will implement an ordered list, OList, class using a singly linked list design. An ordered list keeps its elements in sorted order. The list does not allow duplicate elements. the insert method will return a bool, true if the inset was successful, false if it failed due to duplicate element (if it fails for other reasons you should throw an exception). The linked list example we built in class used raw pointers, for this assignment we will use smart pointers. You must use smart pointers to control resource ownership and ensure there are no memory leaks possible. Interface: The Olist class will implement the following methods: bool insert(int e) inserts the element e to the list and returns true, or if the element e is already on the list returns false. bool remove(int e) removes the element e from the list and returns true if its on the list, returns false if it is not on the list. void clear()empties the list (this method should contain only 1 line of code) bool isEmpty() returns true if the list is empty, and false if it is not. int size() returns the number of elements on the list. Overload Olist operator+() return a list that consists of the two lists merged. Overload Olist operator-() to return a list of all of the elements in the lhs list, with any elements in the rhs list removed. Overload Olist overator/() to return a list of all of the elements that are on both the lhs list and the rhs list. Overload the stream insertion operator operator<<( ) so that the list can be printed using std::cout. When printing the list each element should be comma separated and in square brackets; {[1], [2], [4], [5], [7], [8]}, and an emptly list should print as {} Write a constructor for Olist and provide the functionality of all of the big 5 (destructor, copy constructor, move constructor, assignment operator, move assignment operator), these should all provide at least the strong exception guarantee. An ordered linked list of ints using smart pointers.

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!