Sets and bags, Computer Engineering

Assignment Help:

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


Related Discussions:- Sets and bags

Internet data synchronization, want to know about latest work and research ...

want to know about latest work and research papers on internet data synchronization

Non-uniform memory access model (numa), Non-Uniform Memory Access Model (NU...

Non-Uniform Memory Access Model (NUMA) In shared memory multiprocessor systems, local memories can be joined with every processor. The group of every local memories form the gl

Device drivers in windows system, Q. Device drivers in Windows system? ...

Q. Device drivers in Windows system? In Windows system device drivers are implemented as dynamic link libraries (DLLs). This scheme has advantages which DLLs comprises sharea

Differentiate between the serial port and parallel port, Question: (a) ...

Question: (a) Provide types of computer systems and briefly describe each one. (b) With the help of example, explain the difference between open source software, freeware a

Computer based accounting systems, For the purposes of this assignment, you...

For the purposes of this assignment, you are the accountant for an industrial property development company, Devprop Leasing Co., that typically develops warehouse and industrial co

What are the principal shortcomings of mpi, (a) What are the principal sho...

(a) What are the principal shortcomings of MPI with respect to the deployment between companies and institutions? (b) Propose a possible solution for the parallel computing in

Explain the terms topology used in lans, Explain the terms topology used in...

Explain the terms topology used in LANs. (i) LAN topologies: This network topology is a physical schematic that shows interconnection of the several users. There are four fun

First-order inference rules - artificial intelligence, First-Order Inferenc...

First-Order Inference Rules -artificial intelligence: Now we have a perfect definition of a first-order model is,in the same way, we may define soundness for first-order infere

Find a connection factory, Why do I get an exception when trying to find a ...

Why do I get an exception when trying to find a connection factory? Ans) The exception is regularly something like java.io.InvalidClassException or java.lang.NoClassDefFoundErro

Evaluate fixed execution time, The statement of Gustafson's law can be desc...

The statement of Gustafson's law can be described with the help of an illustration. Let us take a problem, say P, which has to be solved using a parallel computer. Let Ts be the ti

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd