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

Translator for low level programming language, Translator for low level pro...

Translator for low level programming language were called as    Assembler

Dbms, What are the disadvantages of file processing system?

What are the disadvantages of file processing system?

Structure tensor, what is structure tensor?how we calculate for image pixel...

what is structure tensor?how we calculate for image pixel?

3D rotation, Magnify a triangle with vertices A = (0,0), B = (3,3) and C = ...

Magnify a triangle with vertices A = (0,0), B = (3,3) and C = (6,4) to twice its size in such a way that A remains in its original position.

Illustrate master-slave flip-flop, Q. Illustrate Master-Slave Flip-Flop? ...

Q. Illustrate Master-Slave Flip-Flop? Master slave flip-flop comprise two flip-flops. One is master flip-flop and other one is known as slave flip-flop. Fig below shows impleme

Give an example, Write the HTML code for the following table: ...

Write the HTML code for the following table: T E M P E R A T U R E C I T I E S

Design a flash project, The only way to respond effectively to a design pro...

The only way to respond effectively to a design project is to first understand the topic well yourself. To do this you need to research the topic and ask yourself a series of quest

Eight-stage process - conjunctive normal forms, Eight-stage process - Conju...

Eight-stage process - Conjunctive normal forms: Hence we notice the following eight-stage process converts any sentence with CNF as:  1.  Eliminate all arrow connectives by

Idiomatic translations - artificial intelligence, For this exercise you hav...

For this exercise you have to gather and report some linguistic data. Make sure your data are accurate by checking them with a native speaker if you yourself are not a native speak

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