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. Illustration what is the cause of Brownian motion? Answer:- Molecules in a gas move freely, randomly, constantly in all directions and at high speeds. They are capable

Resolution Method - Artificial intelligence: A minor miracle happened in 1965 when Alan Robinson published his resolution function. This function uses a generalized format of t

Visual basic applications have very rich and flexible applications but there is single limitation when using pointer function. Windows API has limited support for function pointers

Important points of simulations In this simulation it is essential to consider: (1)  What and how data is gathered (2)  How simulation is done (3)  How system would wo

What are the advantages of using XML over HTML? The root cause of the problem lies within HTML that is Hyper Text Markup Language, the defector standard for web publication. Th

The expansion of nested macro calls done by using of? Ans. LIFO rule is used for the expansion of nested macro calls.

Direct Rambus DRAM or DRDRAM (sometimes just known as Rambus DRAM or RDRAM) is a type of synchronous dynamic RAM. RDRAM was formed by Rambus inc., in the mid-1990s as a replacement

how can I draw er diagram for sell & storage section of a drugstore?

Multi-Threaded Processors In unit 2, we have gone through the use of distributed shared memory in parallel computer architecture. Although the use of distributed shared memory

What are the disadvantages of a Smart Card? Disadvantages of Smart Cards are as follows: a. The value of money can be depleted and recharged. b. Customers should keep