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. Illustrate Single In-line Memory Modules? From early days of semiconductor memory till the early 1990s memory was manufactured, brought and installed as a single chip. Chip

Utilization Summary The Utilization Summary shows the status of each processor i.e. how much time (in the form of percentage) have been spent by every processor in busy mode, o

Home Shopping TV broadcast of goods for purchase, sent directly to a viewer . This online shopping is available because of e-commerce.

Before we take a detailed look about the Motorola 68HC11 series of micro controllers it is useful to define what is meant by a micro controller. As the name suggests a micro contro

What are the specifications/characteristics used by the manufacturers to describe a digital to analog converter? Explain each one briefly. Ans: D/A converter characteristics

What is XMS Memory system is divided into 3 main parts. TPA (transient program area), system area and XMS (extended memory system). Type of microprocessor in your computer sign

System.Data.DLinq.dll gives functionality to work with LINQ to SQL.

for calculating simple interest

Which of the memories stores the most number of bits ? Ans. 5Mx8 = 5 x 220 x 8 = 40M (max).

Show System call for cloning.  Standard form of Clone function is as follows: Int clone (Int (*FN) (), void *child stack, Int flag, intargs,); Parameter FN is Pointer fro