Sets and bags, Computer Engineering

Task: Sets and bags

In mathematics, the notion of multiset (or bag) is a generalisation of the notion of set.

A bag is a special kind of container in which the items may be repetitive, and without any order. A set is a container in which items may NOT be repetitive (each element in a set is unique).

Our purpose in this assignment is to implement the set and bag concept by using an array-based list structure.

The program

This assignment will be implemented by the use of 2 interfaces named:
1. SetList
2. BagList

The SetList interface will contain the following method headers: 

Sets

The implementation of the SetListType has to take into account the fact that repeat values are not stored. The only requirement as far as this assignment is concerned, is that you use an array-based list structure to implement both sets and bags.

Bags

The implementation of the BagListType has to take into account the fact that repeat values are stored. For the purposes of this assignment , we will employ a dual array technique so as to eliminate having to physically store a value (object) we have already put into our bag structure. One array will store the object, the second array will store the number of times this object is present in our bag structure (i.e., the second array is of type  int)For example, for an input of Integers of the following values:

1 2 3 4 5 3 2

These values would normally be stored in a single array as shown below.

1021_Sets and bags.png

Posted Date: 2/26/2013 2:03:36 AM | Location : United States







Related Discussions:- Sets and bags, Assignment Help, Ask Question on Sets and bags, Get Answer, Expert's Help, Sets and bags Discussions

Write discussion on Sets and bags
Your posts are moderated
Related Questions
Define the Firewall Design Policy A lower-level policy that describes how the firewall will handle prevention of access and filtering of services as defined in the above net

The assignment enhances the acquisition of new knowledge through reading, research and practical work in class and at home. It requires critical thinking applied to real life tasks

A class that has no functionality of its own is an Adaptor class in C++. Its member functions hide the use of a third party software component or an object with the non-compatible

What are qualified associations? A qualified association is an association in which an attribute known as the qualifier disambiguates the object many associated end.

What is the chief advantage of using virtual packets instead of frames? The router can't transfer a copy of a frame from one kind of network to another since the frame formats

Evaluation Functions: Evaluation functions calculate approximately the score which can be prove of guaranteed if a particular world state is reached. Same like in chess, evalu

Illustrate about the macros and give its example For instance, assume you want some data to be input into a spreadsheet if result of a calculation in cell K40 is negative: m

What is slack? 'Slack' is the amount of time you have which is measured through while an event ‘really happens' and while it ‘should happen’. The term ‘really happens' can a

? Object: The interaction among objects takes place in a system. An object is depicted by a rectangle with the name of the object, preceded by a colon and underline. ? Relation

A given microprocessor has words of 1 byte.  What is the smallest and largest integer that can be characterized in the following representations?   a) unsigned b) sign- ma