Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Redo #5 on page 149 using a linked list. Note that a copy constructor, overloade

ID: 672044 • Letter: R

Question

Redo #5 on page 149 using a linked list. Note that a copy constructor, overloaded assignment operator, and a destructor will be needed

5) A bag can contain more than one copy of an item. For example, the chapter describes a bag that contains the number 4 and two copies of the nnumber 8. This bag behavior is different from a set, which can contain only a single copy of any given item.Write a new container class called ser, which is similar to a bag, except that a set can contain only one copy of any given item, You'll need to change the interface a bit. For example, instead of the bag's count funtion, you'll want a constant member function suich as this:

bool set:: contains

(const value_type& target) const;

//Postcondition: The return balue is true if target is in the set; otherwise the return value is false.

Make an explicit statement of the invariant of the set class. Do a time analysis for each operation. At this point, an efficiemt implementation is not needed. For example, just adding a new item to a set will take linear time becauseyou'll need to check that the new item isn't already present, Later we'll explore more efficient implementations (including the implementation of set in the C++ Stadard Library.

You may also want to add additional operations to your set class, such as an operator for subtraction.

Use C++ and please create 3 file incuding header file

Here is the header file to begin:

Explanation / Answer

poly.h

poly.cpp

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote