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
AI Applications Search is a crucial component of an AI system, and the search functions are performed over large quantities of difficult structured data using unstructured inpu

The Gantt chart shows the several activities of each processor with respect to progress in time in idle-overhead -busy modes with respect to each processor. Kiviat diagram:  Th

Which loader is executed when a system is first turned on or restarted? Ans. Bootstrap loader executed while a system is first turned on or restarted.

Give an intuitive explanation of why the maximum throughput, for small beta, is approximately the same for CSMA slotted Aloha and FCFS splitting with CSMA. Show the optimal expecte

What are advantages and benefits to businesses by e-commerce over extranets? The advantages and benefits to businesses comprise: Less Paperwork: along with documents and bus

consider an open circuit pn junction.sketch curves as a function of distance across the junction of space charge ,electric field and potential

Differentiate between intranet and internet Some comparisons between intranet and internet include: -  INTERNET is INTERnational NETwork -  An INTRANET is INTernal Restri

Q. Write a menu driven program to perform addition and subtraction in base 5. Check that entered numbers are in base 5 or not else error message should be displayed.

What are the methods for handling deadlocks?  The deadlock problem can be dealt with in one of the three ways:  a. Use a protocol to prevent or avoid deadlocks, make sure th

How will you form an 8 bit adder using 2 four bit adder IC's 7483? Ans: 4 bit adder IC is IC 7483. This has two four bit data inputs and output carry, 4 bit data output carr