1. Write a program which implements an unbounded sorted set (using the single or double- linked list) as a template structure (aimed at storing unique values of any type and ordering them in ascending order - from the lowest to the greatest), and the methods operating on this structure:
• the default constructor,
• the destructor (with memory deallocation),
• the copy-constructor (with memory allocation),
• the assignment operator= (with memory dellocation and allocation),
• the comparison operator==,
• insert – adding a value to the set in ascending order only if it doesn't exist in the set (with memory allocation),
• erase – removig the given value from the set if exists (with memory deallocation) and returning the number of items removed (0 or 1),
• count – returning the number of occurences of a value (0 or 1),
• empty – informing whether the set is empty,
• size – returning the number of items in the set,
• clear – removing all the items from the set (with memory deallocation).
The program should use all these methods to make the operations as follows:
1) create a set of integers containing the numbers given by the user, 2) print the number of items stored in the set,
3) remove a value from the set,
4) print the number of items stored in the set, 5) check if a given value is in the set,
6) clear the set.
Compare your implementation of the container with the built-in container set delivered in the <set> library.
2. Use the Fraction structure from the 1st task of lab 2 and implement a program working on sets of fractions (use the set implemented in task 1). Create two sets of fractions and allow the user to:
- add a fraction to one of the sets (remember that fractions 1/2 and 2/4 are eqaul, so if the user wants to add them to a single set, only one of the fractions should be finally in the set), - remove a fraction from one of the sets,
- print the items stored in the sets,
- check if a fraction is in one or both sets,
- compare the sets (whether they contain the same values).