Question: Implement two versions (5 programs) of a set data structure and write a driver to test all your set operations. The set operations that you

Implement two versions (5 programs) of a set data structure and write a driver to test all your set operations. The set operations that you should surely include are Union, Intersection and Difference. The driver can be as simple as asking the user to enter two sets and then presenting a simple menu that allows the user to select the operation they want to test. Have the menu in a loop so that the user can test any other operation unless they choose to exit the menu. Also, put the application that uses sets in the menu for the user to select.

1. C/C++ version that uses a regular array for representing a set. Create appropriate functions for set operations that take in two sets to do the operations.

2. C/C++ version same as above but uses a pointer that is allocated memory using new to create any array for the set

3. C/C++ version that uses a pointer as a private data in a class called set (create this class) and add overloaded operators to this for doing the set operations that I have mentioned.

4. Create a Java Class called set and uses arrays and add appropriate methods for the set operations

5. Create a Java Class called set and uses arrayList and add appropriate methods for the set operations Also, test your programs via some application that uses sets. Think of some practical application of sets (you can research this online).

e.g. One example of compiler optimization is "reach" definition calculation that uses a lot of sets (worklist algorithm). Write the algorithm of the application you choose and use the set program that you wrote above.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!