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
Fail-first - artificial intelligence: Alternatively one such dynamic ordering procedure is known like "fail-first forward checking". In fact the idea is to take advantage of i

Define memory management system? The part of the computer system that supervises the flow of information among auxiliary memory and main memory is known as memory management sy

What is Instruction Cycle A program residing in the memory unit of the computer having of a sequence of instructions.  The program is implemented in the computer by going throu

Three state table buffers Three state table buffers: A bus system can be constructed with the help of three state gates instead of multiplexers. A three states gate is digital

Extend task 1 so that it now supports a memory buffer of limited size. Provide the same functionality as task 1 except now make the server work with a limited buffer size. Like

As an XML expert you are needed to model a system for an online furniture shop. After an interview with the shop manager you have the certain information: The detail of th

In a word,you can't. It would certainly be helpful to be able to color-code your worksheet tabs. For some reason, Microsoft hasn't executed this feature, which has been available i

Disadvantage and Advantage of mutual-exclusion implementation with semaphores. Disadvantage: Mutual-exclusion solutions specified by semaphores require busy waiting. Tha

Paging supervisor: This part of the operating system built and manages the page tables. If the  due to dynamic address translation hardware a page fault occurs exception then

Explain Tri-state logic inverter with the help of a circuit diagram. Give its Truth Table. Ans: Tri-state Logic Inverter: The functional diagram of Tri-state Logic Inve