
Write c++ code
Implement a class (template) SortedSet which is actually a singly linked list with head and tail pointers. It
will store data in ascending order while disallowing duplicate data. Implement the following member
functions for this class.
1. Default Constructor. SortedSet();
2. An insert function that will insert the data such that resultant set is in ascending order. Duplicate
data will not be allowed. void insert(T const data);
3. A delete function that will delete the element at the given index. void delete(int
const index);
4. A print function that will print the contents of the sorted set. void print() const;
5. A union function that will be passed another sorted set. This function will take union of two sets
and store the result in the first set. void union(SortedSet<T>const &otherSet);
For example:
SortedSet a; (suppose it has 1, 2, 3, 4, 10, 50)
SortedSet b; (suppose it has 6, 10, 11)
a.union(b); (a will now contain 1, 2, 3, 4, 6, 10, 11, 50)
6. An intersection function that will be passed another sorted set. This function will take
intersection of two sets and store the result in the first set. void
intersect(SortedSet<T>const & otherSet);
You can create any other helper member functions for SortedSet if you want.

Trending nowThis is a popular solution!
Step by stepSolved in 2 steps with 5 images

- use replit please Thank youarrow_forwarduse repli please. thanarrow_forwardPlease just use main.cpp,sequence.cpp and sequence.h. It has provided the sample insert()function. No documentation (commenting) is required for this assignment. This assignment is based on an assignment from "Data Structures and Other Objects Using C++" by Michael Main and Walter Savitch. Use linked lists to implement a Sequence class that stores int values. Specification The specification of the class is below. There are 9 member functions (not counting the big 3) and 2 types to define. The idea behind this class is that there will be an internal iterator, i.e., an iterator that the client cannot access, but that the class itself manages. For example, if we have a Sequence object named s, we would use s.start() to set the iterator to the beginning of the list, and s.advance() to move the iterator to the next node in the list. (I'm making the analogy to iterators as a way to help you understand the point of what we are doing. If trying to think in terms of iterators is confusing,…arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education





