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
What is process control block?  Each process is shown in the OS by a process control block. It having many pieces of information associated with a specific process.

Name the concepts of Object oriented There are various concepts of object oriented analysis Abstraction, Encapsulation, Identity, Modularity, Hierarchy, Typin

Stack overflow causes   (A) Hardware interrupt.  (B) External interrupt.  (C) Internal interrupt.   (D) Software interrupt. Stack overflow occurs whereas execution

Shared Memory Refers to the memory part of a computer system in which the memory can processed directly by any of the processors in the system. Distributed Memory Refer

The scheduling in which CPU is allocated to the process with least CPU-burst time is called? Ans. Shortest job first Scheduling wherein CPU is allocated to the process with lea

A different smooth structure on R: Show that (U, f) given by U = R, f : x -> x3, is a local chart of the topological manifold M = R which is not a member of the standard smoo

Convenience of Environments -artificial intelligence: In some cases, some aspects of an environment which should be taken into account in decisions about actions may be unavai

Q. What is Internet Routing Hierarchy? So how do packets find their way across Internet? Does every computer connected to Internet know where other computers are? Do packets ba

What are the components of I-way Infrastructure? There are three components of the I-way infrastructure: • Consumer access equipment • Local on-Ramps • Global informat

W To date we have discussed elementary high level language programming and low level assembler programming, one of the benefits of C is the integration of both , this requires a re