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

Procedure which divides a 32-bit number by a 16-bit number, Write a procedu...

Write a procedure which divides a 32-bit number by a 16-bit number. The procedure must be general which is it's defined in one module and can be called from another assembly module

Which is valid syntax of the fork and join primitive, Which is valid syntax...

Which is valid syntax of the Fork and Join Primitive? Ans. A valid syntax of the Fork and Join Primitive is as given below: Fork Join

Define dma controller, Define DMA controller. The I/O device interface ...

Define DMA controller. The I/O device interface control circuit that is used for direct memory access is called as DMA controller.

What is a switchboard, What is a switchboard A switchboard is only a f...

What is a switchboard A switchboard is only a form with command button that open other switchboard or perform tasks like opening forms and printing reports. Switchboard is a t

Explain chomsky classification of languages, Explain chomsky classification...

Explain chomsky classification of languages with suitable examples Ans: Any language is appropriate for communication provided the syntax & semantic of the language is termed t

Soundness - artificial intelligence, Soundness - artificial intelligence: ...

Soundness - artificial intelligence: You may see in some application domains-for example automated theorem proving - that your search is "sound and complete". The soundness in

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.

Units of artificial neural networks, Units of artificial neural networks: ...

Units of artificial neural networks: However the input units simply output the value that was input to them from the example to be propagated. So every other unit in a network

Basic idea - learning decision trees, Basic idea: However in the above...

Basic idea: However in the above decision of tree which it is significant that there the "parents visiting" node came on the top of the tree. Whether we don't know exactly the

#artificial intelligence, does matlab contain procedures for knoledge repre...

does matlab contain procedures for knoledge representation? if yes where can i find it?

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