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: 


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.


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
Q. Explain the typical organization of a computer? There are two principal components: hardware and software. The former refers to physical components such as memory unit (MU),

The xlswrite function can write the contents of a cell array to a spreadsheet.  A manufacturer kepts information on the weights of some parts in a cell array.  Every row stores the

The IT infrastructure of MobTex is simple but vital to the operation of the business. All client data, billing, stock management etc is done via a specialised application called "A

Q. Write a Menu driven program to convert the given Decimal number into Binary, Octal and Hexadecimal number. (Fractional numbers are allowed)

The hybrid models are mostly tailormade models suiting to exact applications. Actually these fall in the category of mixed models. Such type of application-oriented models keep cro

Explain division and its restoring and non-restoring techniques?

Functional units of a computer system: Digital computer systems consist of 3 distinct units. These units are as follows:  Central Processing unit Input unit and Output unit.

Illustrates about Metal Fix. A Metal Fix implies that only the upper metal interconnects layers are influenced. Connections may be made or broken, but new cells may not be adde

Internal Path length It is described as the number of node traversed while moving by one particular node to any other node in the tree.

The excess 3 code of decimal number 26 is ? Ans. (26) 10 in BCD is (00100110) BCD Add 011 to all BCD 01011001 for excess - 3