Problem Statement: Create ADT that implements the SET concept using linked list or arrays. Background: A set is an abstract data type that can store unique values, without any particular order. The value of the element cannot be modified once it is added to the set, though it is possible to remove and add the modified value of that element. Unlike list type, rather than retrieving a specific element from a set, one typically tests a value for membership in a set. The type of sets we want to implement is dynamic sets. Dynamic sets allow to change after they are constructed. Sets allow query operations on their elements - such as checking whether a given value is in the set, or enumerating the values in some arbitrary order. Sets can be implemented using various data structures, which provide different time and space trade-offs for various operations. It can be implemented using arrays or linked list. In this assignment we have to use arrays to implement the SET data structure. We have to use template concept so that sets can be of any type. Following Basic Operations has to be implement in this assignment: 1) InsertItem(Item): Add Item to the SET. No duplicate elements can be inserted in any order. 2) Removeltem(Item): Remove the Item from SET. 3) FindItem(Item): Return true if Item is in SET. 4) Size(): Return number of elements in the SET. 5) Reset(): Resets the current position to the beginning of the SET which is used to loop over the SET elements using GetNextItem() function. 6) GetNextItem(): Returns the next element in the SET according to the current position. 7) IsLastltem(): Returns true of the current position is at the last element in the SET. 8) Intersection(aSet): Returns new SET object which represents the intersection of two sets. 9) Union(aSet): Returns new SET object which represents the union of two sets. 10) Difference(set): Returns new SET object which represents the intersection of two sets. 11) IsSubsetOf(aSet): return true if SET in subset of aSet. 12) ISEqual(aSet): returns true if two sets are equal. 13) MakeEmpty(): Deletes all elements in the SET. 14) ISEmpty(): Returns true if the SET is empty. 15) IsFull(): Returns true if the SET is full. 16) Print(): Print all elements in the SET.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter17: Linked Lists
Section: Chapter Questions
Problem 13PE
icon
Related questions
Question
Problem Statement:
Create ADT that implements the SET concept using linked list or arrays.
Background:
A set is an abstract data type that can store unique values, without any particular order.
The value of the element cannot be modified once it is added to the set, though it is possible to remove
and add the modified value of that element.
Unlike list type, rather than retrieving a specific element from a set, one typically tests a value for
membership in a set.
The type of sets we want to implement is dynamic sets. Dynamic sets allow to change after they are
constructed.
Sets allow query operations on their elements - such as checking whether a given value is in the set, or
enumerating the values in some arbitrary order.
Sets can be implemented using various data structures, which provide different time and space trade-offs
for various operations. It can be implemented using arrays or linked list.
In this assignment we have to use arrays to implement the SET data structure.
We have to use template concept so that sets can be of any type.
Following Basic Operations has to be implement in this assignment:
1) InsertItem(Item): Add Item to the SET. No duplicate elements can be inserted in any order.
2) Removeltem(Item): Remove the Item from SET.
3) FindItem(Item): Return true if Item is in SET.
4) Size(): Return number of elements in the SET.
5) Reset(): Resets the current position to the beginning of the SET which is used to loop over the SET
elements using GetNextItem() function.
6) GetNextItem(): Returns the next element in the SET according to the current position.
7) IsLastltem(): Returns true of the current position is at the last element in the SET.
8) Intersection(aSet): Returns new SET object which represents the intersection of two sets.
9) Union(aSet): Returns new SET object which represents the union of two sets.
10) Difference(set): Returns new SET object which represents the intersection of two sets.
11) IsSubsetOf(aSet): return true if SET in subset of aSet.
12) IsEqual(aSet): returns true if two sets are equal.
13) MakeEmpty(): Deletes all elements in the SET.
14) ISEmpty(): Returns true if the SET is empty.
15) IsFull(): Returns true if the SET is full.
16) Print(): Print all elements in the SET.
Transcribed Image Text:Problem Statement: Create ADT that implements the SET concept using linked list or arrays. Background: A set is an abstract data type that can store unique values, without any particular order. The value of the element cannot be modified once it is added to the set, though it is possible to remove and add the modified value of that element. Unlike list type, rather than retrieving a specific element from a set, one typically tests a value for membership in a set. The type of sets we want to implement is dynamic sets. Dynamic sets allow to change after they are constructed. Sets allow query operations on their elements - such as checking whether a given value is in the set, or enumerating the values in some arbitrary order. Sets can be implemented using various data structures, which provide different time and space trade-offs for various operations. It can be implemented using arrays or linked list. In this assignment we have to use arrays to implement the SET data structure. We have to use template concept so that sets can be of any type. Following Basic Operations has to be implement in this assignment: 1) InsertItem(Item): Add Item to the SET. No duplicate elements can be inserted in any order. 2) Removeltem(Item): Remove the Item from SET. 3) FindItem(Item): Return true if Item is in SET. 4) Size(): Return number of elements in the SET. 5) Reset(): Resets the current position to the beginning of the SET which is used to loop over the SET elements using GetNextItem() function. 6) GetNextItem(): Returns the next element in the SET according to the current position. 7) IsLastltem(): Returns true of the current position is at the last element in the SET. 8) Intersection(aSet): Returns new SET object which represents the intersection of two sets. 9) Union(aSet): Returns new SET object which represents the union of two sets. 10) Difference(set): Returns new SET object which represents the intersection of two sets. 11) IsSubsetOf(aSet): return true if SET in subset of aSet. 12) IsEqual(aSet): returns true if two sets are equal. 13) MakeEmpty(): Deletes all elements in the SET. 14) ISEmpty(): Returns true if the SET is empty. 15) IsFull(): Returns true if the SET is full. 16) Print(): Print all elements in the SET.
Notes:
1. Name the template class SetType. After coding the template write a complete program to test the various
operations in the class.
2. Use the online compiler available at (https://ide.geeksforgeeks.org/index.php) to test your final
version of the program
3. Submission instructions:
write a detailed note (As comments) about the functionality of the program and complete
instructions on how to run it.
make sure you include your name in the program.
- make sure the program is fully commented, and compiles and runs correctly.
Use the online compiler available at (https://ide.geeksforgeeks.org/index.php) to test your final
version of the program.
Run the program by choosing the option on the website that says: Run+URL(Generates URL as well)
- Copy the URL generated for the program
Submit your assignment by sending me the URL on the AAU elearning system.
Here is the class specification
//******* Set data structure class **
const int MAX_ITEMS = 100;
templatecclass ItemType>
class SetType {
public:
SetType();
void InsertItem(ItemType);
void RemoveItem(ItemType);
bool FindItem(ItemType);
int Size() const;
void Reset();
ItemType GetNextItem();
bool IslastItem();
SetType<ItemType> Intersection( SetType<ItemType>&);
SetType<ItemType> Union( SetType<ItemType>&); 7/
SetType<ItemType> Difference( SetType<ItemType>&);
bool IsSubsetof( SetType<ItemType>&);
bool IsEqual( SetType<ItemType>&);
void MakeEmpty ();
bool IsEmpty() const;
bool IsFull() const;
void Print();
private:
int length;
ItemType info[MAX_ITEMS];
int currentPos;
};
Transcribed Image Text:Notes: 1. Name the template class SetType. After coding the template write a complete program to test the various operations in the class. 2. Use the online compiler available at (https://ide.geeksforgeeks.org/index.php) to test your final version of the program 3. Submission instructions: write a detailed note (As comments) about the functionality of the program and complete instructions on how to run it. make sure you include your name in the program. - make sure the program is fully commented, and compiles and runs correctly. Use the online compiler available at (https://ide.geeksforgeeks.org/index.php) to test your final version of the program. Run the program by choosing the option on the website that says: Run+URL(Generates URL as well) - Copy the URL generated for the program Submit your assignment by sending me the URL on the AAU elearning system. Here is the class specification //******* Set data structure class ** const int MAX_ITEMS = 100; templatecclass ItemType> class SetType { public: SetType(); void InsertItem(ItemType); void RemoveItem(ItemType); bool FindItem(ItemType); int Size() const; void Reset(); ItemType GetNextItem(); bool IslastItem(); SetType<ItemType> Intersection( SetType<ItemType>&); SetType<ItemType> Union( SetType<ItemType>&); 7/ SetType<ItemType> Difference( SetType<ItemType>&); bool IsSubsetof( SetType<ItemType>&); bool IsEqual( SetType<ItemType>&); void MakeEmpty (); bool IsEmpty() const; bool IsFull() const; void Print(); private: int length; ItemType info[MAX_ITEMS]; int currentPos; };
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 6 images

Blurred answer
Knowledge Booster
Lists
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning