Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please ASAP!! Question 1 (40 points A set is a collection of unordered items that contains no duplicates. Sets are important in Mathematics and are

image text in transcribed

image text in transcribed

image text in transcribed

Please ASAP!!

Question 1 (40 points A set is a collection of unordered items that contains no duplicates. Sets are important in Mathematics and are useful in programming to keep track of distinct items such as the courses someone registered for, or a person's friends in a social network. Implement a class called MySet that represents a set of integers. My.Setclass will be composed of a singly linked list object as a data member. You should use the list implementation (List that we went through in class. The class should use two member variables: items a singly linked list of integers sire: an integer variable that keeps track of the number of elements in the set The class should have the following functionalities: Function Prototype Description Myset The default constructor. Creates an empty set. int getsize() const Returns the number of elements in the set. bool is Empty )const Returns true if the set is empty, false otherwise. void add(int el) Adds a new element el to the set. The element is added only if the set does not have elas a member. void remove (int el) Removes el from the set. void intersection (Myset& T, Myset& I) The intersection of this and T. The result will be stored in I. I is the set containing the elements that are in both this and void Union (MySet& T, MySet& U) The union of this and T. The result will be stored in U. U is the set containing the elements that are in this or T, or both. U is a set, so there should be no duplicate items. Question 1 (40 points A set is a collection of unordered items that contains no duplicates. Sets are important in Mathematics and are useful in programming to keep track of distinct items such as the courses someone registered for, or a person's friends in a social network. Implement a class called MySet that represents a set of integers. My.Setclass will be composed of a singly linked list object as a data member. You should use the list implementation (List that we went through in class. The class should use two member variables: items a singly linked list of integers sire: an integer variable that keeps track of the number of elements in the set The class should have the following functionalities: Function Prototype Description Myset The default constructor. Creates an empty set. int getsize() const Returns the number of elements in the set. bool is Empty )const Returns true if the set is empty, false otherwise. void add(int el) Adds a new element el to the set. The element is added only if the set does not have elas a member. void remove (int el) Removes el from the set. void intersection (Myset& T, Myset& I) The intersection of this and T. The result will be stored in I. I is the set containing the elements that are in both this and void Union (MySet& T, MySet& U) The union of this and T. The result will be stored in U. U is the set containing the elements that are in this or T, or both. U is a set, so there should be no duplicate items

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_2

Step: 3

blur-text-image_3

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

Building Database Driven Catalogs

Authors: Sherif Danish

1st Edition

0070153078, 978-0070153073

More Books

Students also viewed these Databases questions

Question

What's a dealbreaker for you in a relationship?

Answered: 1 week ago

Question

Explain the various methods of job evaluation

Answered: 1 week ago

Question

Differentiate Personnel Management and Human Resource Management

Answered: 1 week ago

Question

Describe the functions of Human resource management

Answered: 1 week ago

Question

What are the objectives of Human resource planning ?

Answered: 1 week ago

Question

LO12.3 Explain how demand is seen by a pure monopoly.

Answered: 1 week ago