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

Define technique of improving priority of process wait queue, is a techniqu...

is a technique of improving the priority of process waiting in Queue for CPU allocation? Ageing is a technique of enhancing the priority of process waiting in Queue for CPU all

Rules for minimisation using k maps, 1) All squares containing a 1 must be ...

1) All squares containing a 1 must be grouped. 2) The largest possible groups must be formed. 3) Groups can overlap if this allows larger groups to be formed. 4) Groups mu

Modality and cardinality, Ask question #Midifference between cardinality an...

Ask question #Midifference between cardinality and modality nimum 100 words accepted#

What are attributes, What are Attributes?  Attributes are declarative ...

What are Attributes?  Attributes are declarative tags in code that insert additional metadata into an assembly. There exist two types of attributes in the .NET Framework: Pred

Conjunctive normal forms, Conjunctive Normal Forms: However there for ...

Conjunctive Normal Forms: However there for the resolution rule to resolve two sentences so they must both be in a normalised format called as conjunctive normal form, that is

Define the difference between static ram and dynamic ram, Define the differ...

Define the difference between static RAM and dynamic RAM? The RAM family comprises two important memory devices that are static RAM (SRAM) and dynamic RAM (DRAM). The main diff

What are the event key words in interactive reporting, What are the event k...

What are the event key words in interactive reporting? Event Keyword                                                 Event AT LINE-SELECTION         Moment at which the u

What is asynchronous dram, What is asynchronous DRAM? In asynchronous D...

What is asynchronous DRAM? In asynchronous DRAM, the timing of the memory device is controlled asynchronously. A specialized memory controller circuit gives the essential contr

Pc configuration and troubleshooting, You have been asked to become the con...

You have been asked to become the consulting technician for MobTex, a local auto servicing centre. The general manager (Jo) realises that the IT system has evolved over time with l

Differences between datagrid and datalist, Differences between Datagrid, Da...

Differences between Datagrid, Datalist and Repeater?   1. Datagrid has paging while Datalist doesnt. 2. Datalist has a property known as repeat. Direction = vertical/horizon

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