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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started