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

Explain characteristics of prototyping, Question: (a) List five main c...

Question: (a) List five main characteristics of ‘Prototyping'. (b) Describe briefly why ‘Prototyping' is essential to Rapid Application Development. (c) Describe the 2 t

Which is not a valid page replacement policy, Which is not a valid page rep...

Which is not a valid page replacement policy? Ans. RU policy (Recurrently used) is not a valid page replacement policy.

With what symbolic names can be associated, Symbolic names can be associate...

Symbolic names can be associated with? Ans. With data or instruction symbolic names associated.

Java, mine sweeper algorithm.

mine sweeper algorithm.

What is the future of hyper threading, Q. What is the Future of Hyper threa...

Q. What is the Future of Hyper threading? Current Pentium 4 based MPUs employ Hyper-threading however next-generation cores, Conroe, Merom and Woodcrest will not. As some have

Control dependence, Control Dependence Segments or Instructions in a pr...

Control Dependence Segments or Instructions in a program may obtain control structures. Thus, dependency between the statements can also be in control structures. But the order

What is combinational circuits, Q. What is Combinational circuits? Comb...

Q. What is Combinational circuits? Combinational circuits are interconnected circuits of gates according to definite rules to generate an output relying on its input value. A w

What is imprecise and precise exception, What is imprecise and precise exce...

What is imprecise and precise exception? Situation in which one or more of the succeeding instructions have been implemented to completion is known as imprecise exception. Situ

Explain the register transfer language, Explain the Register transfer langu...

Explain the Register transfer language Register transfer language means there must be data flow between two registers and logic is in between them for end registers data must f

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