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

What are the features of the hardwired control, What are the features of th...

What are the features of the hardwired control? A controller that uses this approach can function at high speed. It has little flexibility and the complexity of the instruction

Associativity of connectives - equivalences rules, Associativity of Connect...

Associativity of Connectives : Here brackets are very important in order to tell us where to perform calculations in arithmetic and logic. By using these brackets we evaluate

What are the different types of distributing frames, What are the different...

What are the different types of distributing frames used in exchanges? The various distribution frames used in exchange are demonstrated in figure. Every subscriber in a telep

Explain multiple instruction and single data stream (misd), Multiple Instru...

Multiple Instruction and Single Data stream (MISD): In this type of organization multiple processing elements are ordered under the control of multiple control units. Every contro

Show the mips addressing modes, Q. Show the MIPS Addressing Modes? MIP...

Q. Show the MIPS Addressing Modes? MIPS Addressing Modes MIPS employs various addressing modes: 1. Uses Register as well asimmediate addressing modes for operations.

Convert the decimal numbers into hexadecimal, Q Convert the following DECIM...

Q Convert the following DECIMAL numbers into HEXADECIMAL, double check by converting the result HEXADECIMAL to DECIMAL. a)    24 b)   547.56

Classifier with classes, Consider one versus the rest voting used for class...

Consider one versus the rest voting used for classifier with three classes {a, b, c}. Given a row of data denoted as x0 suppose that the classifier for a versus the rest predicts t

Code density and smaller faster programs, Q. Code Density and Smaller Faste...

Q. Code Density and Smaller Faster Programs? Memory was very expensive in older computer. So there was a need of less memory utilization, which is it was cost effective to have

Illustrate the disadvantages of wireless technology, Disadvantages of wirel...

Disadvantages of wireless technology -  Range can be very limited -  Possible interference from nearby electronic devices -  Security issues (i.e. tapping illegally into

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