[Solved] CSE330 Homework Assignment 4

$25

File Name: CSE330_Homework_Assignment_4.zip
File Size: 263.76 KB

SKU: [Solved] CSE330 Homework Assignment 4 Category: Tag:
5/5 - (1 vote)

This assignment will have you add the standard set operations, union, intersection, and set difference to class Set. Also add a member function max_depth which is to return the length of the deepest node in a given Set<T> data structure objects. Consider the root to be located at depth 0.

Add the following to the public interface of class Set (5 points each) in your Set.h header file.

Set<T> set_union(Set<T> otherset) { }

Set<T> set_intersection(Set<T> otherset) { }

Set<T> set_difference(Set<T> otherset} {}

int max_depth(){}

Also write your own int main() function (e.g., in a file SetHw4.cpp) that will test your functions in the following manner: (10 pts)

  • Two Set<int> objects setA and setB are declared.
  • Set setA is filled with integer values from a vector (traversed left to right) which contains a random permutation of multiples of 3 between 3 and 36.
  • Set setB is filled with integer values from a vector which contains a random permutation of multiples of 3 between 18 and 54.
  • With the use of a Set<int>::iterator the contents of sets setA and setB is printed out.
  • After printing each set, the depth that is determined by max_depth() for each set is reported.
  • The set_union function is tested by computing the union of setA and setB, followed by the set_interaction of setA and setB. The contents of both resulting sets is printed out.
  • Then two difference sets are computed: the result of subtracting setB from setA, and the result of subtracting setA from setB. The contents of both difference sets is printed out.

For the vectors of integers from which the sets are to be filled, you may use the Standard Template Library <vector>; 2 bonus points if you use our home-baked Vector.h for this assignments (to obtain the bonus, your code must be a program the compiles and runs.)

Submit on Monday, March 9, 2020, via electronic portal : (1) A copy of your file Set.h with the three set operations implemented, a copy of your file SetHw4.cpp, (3) A typescript or screen

shot which demonstrate the compiling and running of your program

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] CSE330 Homework Assignment 4
$25