Question: Mini-project: Extending the ADT Bag using vector In CISC 1100 or 1400, you learned how to compute the union, intersection, and difference of sets The

 Mini-project: Extending the ADT Bag using vector In CISC 1100 or

1400, you learned how to compute the union, intersection, and difference of

Mini-project: Extending the ADT Bag using vector In CISC 1100 or 1400, you learned how to compute the union, intersection, and difference of sets The union, intersection, and difference of bags are defined analogously. The only real difference is that since bags may contain repeated elements, the union (or intersection or difference) of bags may contain repeated elements. For example, suppose that we define bags and B 1, 2, 3, 3, 4, 4, 5] (Here, we use ] to denote bags, similarly to the way that .. \ denotes a set. Also, there's no reason to assume that a bag is sorted; we show the bag elements in sorted order to simply to make it easier to follow the example.) Then AUB [1,1, 1, 2,2, 2, 3, 3, 3, 4,4,4,4,4, 5] AnB [1,2, 3,4,4] A- B1, 2,4] See Exercises 1.6-1.8 for further discussion. The purpose of this project is to add these operations to our Bag ADT Before doing so, note that the author has given us two different implementations: array- based and link-based. The main problem with the former is that the implementer must decide how big to make the underlying array. This problem doesn't exist for the latter, however, linked structures are more complicated than arrays. However, if we were to use a vector-based implementation, then we wouldn't need to worry about how to choose the size of an array; moreover, vectors are easier to handle than linked structures. So the first thing to do is to create VectorBag, a vector-based implementation. Since vectors may be thought of as "safe arrays", the best thing to do would be to start with the array- based implementation and work from there. Once you've done this, you should now add new operations to the VectorBag class Since the standard symbols U and are not available on our keyboard and since union is Mini-project: Extending the ADT Bag using vector In CISC 1100 or 1400, you learned how to compute the union, intersection, and difference of sets The union, intersection, and difference of bags are defined analogously. The only real difference is that since bags may contain repeated elements, the union (or intersection or difference) of bags may contain repeated elements. For example, suppose that we define bags and B 1, 2, 3, 3, 4, 4, 5] (Here, we use ] to denote bags, similarly to the way that .. \ denotes a set. Also, there's no reason to assume that a bag is sorted; we show the bag elements in sorted order to simply to make it easier to follow the example.) Then AUB [1,1, 1, 2,2, 2, 3, 3, 3, 4,4,4,4,4, 5] AnB [1,2, 3,4,4] A- B1, 2,4] See Exercises 1.6-1.8 for further discussion. The purpose of this project is to add these operations to our Bag ADT Before doing so, note that the author has given us two different implementations: array- based and link-based. The main problem with the former is that the implementer must decide how big to make the underlying array. This problem doesn't exist for the latter, however, linked structures are more complicated than arrays. However, if we were to use a vector-based implementation, then we wouldn't need to worry about how to choose the size of an array; moreover, vectors are easier to handle than linked structures. So the first thing to do is to create VectorBag, a vector-based implementation. Since vectors may be thought of as "safe arrays", the best thing to do would be to start with the array- based implementation and work from there. Once you've done this, you should now add new operations to the VectorBag class Since the standard symbols U and are not available on our keyboard and since union is

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!