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
Floating point Arithmetic pipelines Floating point computations are the finest candidates for pipelining. Take the instance of addition of two floating point numbers. Following

Q. Explain about Semiconductor Memories? Originally IC technology was used for constructing processor however soon it was realized that same technology can be used for construc

Branch (control) hazards in computer architecture : Branching hazards (also called control hazards) take place when the processor is told to branch -for example, if a defin

Show by induction that your closed formula from (c) is the number of times that the given statement is implemented for a problem of size n.Note: if your proof is easily  a proof th

What are the risks by customer's perspective in Electronic Payment Systems? Risks within Electronic Payment Systems: Through the customer's perspective are as follows:

Define Alphabet and String? A finite set of symbols is termed as alphabet. An alphabet is frequently signified by sigma, yet can be specified any name. B = {0, 1} here B is

Your JDBC code may throw the following exception: "The coordinator has rolled back the transaction.No further JDBC access is permitted within this transaction." The WebLogic

State about AGP The latest addition to many computer systems is the inclusion of accelerated graphics port (AGP). AGP operates at the bus clock frequency of the microprocessor.

Explain Tabulation Method for simplifying k maps? The Tabulation Method (QUINE-McCLUSKEY MINIMIZATION) An expression is represented in the canonical SOP form if not

Explain the basic performance equation Ans: The basic performance equation is following T = N * S/ R T =>  It is processor time required to execute a program N => act