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.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
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
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education