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
Q. Explain Addressing modes in RISC? Simple addressing modes: Another benefit is the use of simple addressing modes. RISC machines employ simple register addressing having disp

Multi-Layer Artificial Neural Networks : However we can now look at more sophisticated ANNs that are known as multi-layer artificial neural networks it means they have hidden

Main script section ("Sub Main .. End Sub) and function bodies should fit within an A4-page (approx. two monitor-pages). If the code doesn't fit it is a candidate to do more decoup

Q. What do you mean by Keyboard Touch? When employing a keyboard the most important factor is the feel of keyboard it implies that how typing feels on that specific keyboard.

How to manage the web based projects? Many project management applications contain additional functions useful in the management of group projects. These features may contain g

Im doing computer engineering in Thailand.. Second year, and got project regarding sysnal and systems.. I and my team mates have no idea on what should we do.. Could u kindly sugge

Q. Example on hamming error correcting code? For illustration a 4-bit matching word can stand for 2 4 =16 values that range from 0 to 15 as: 0000, 0001, 0010, 0011, 0100, 01

A message is a string of bytes that has meaning to the applications that use it Message = Header(s) + Application Data A message having of a header and the attached applicat

Explain the components of Information Super Highway Infrastructure. The Information Superhighway is more than the Internet. It is a sequence of components, having the collectio

ascii code add=2unit,replace=1unit,delete=3unit.convert ascii code in minimum cost