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

How to create a rollover image, Q. How to Create a Rollover Image? A ro...

Q. How to Create a Rollover Image? A rollover image is an image whose display changes when pointer passes ('rolls') over it. You will use Dreamweaver's Insert Rollover Image co

Write a short note on structure chart, Write a short note on structure char...

Write a short note on structure chart.    Structure Chart is an significant program design method and it shows all components of code in a hierarchical format

Entrepreneurship, explain succession planning and strategies for harvesting...

explain succession planning and strategies for harvesting and ending the venture

8259 PIC, plz expalain interfacing of 8259 with 8085 step wise

plz expalain interfacing of 8259 with 8085 step wise

Build and fix model, Why Build and fix model is considered as ad-hoc softwa...

Why Build and fix model is considered as ad-hoc software development model?

What specifies by environment variable in cgi script, The Environment varia...

The Environment variable SCRIPT_NAME in CGI script specifies? In CGI script gives the path of URL after server name.

Cost involved in inter - processor communication, Cost Involved in Inter-Pr...

Cost Involved in Inter-Processor Communication Because data is assigned to too many processors in a parallel computer whilst executing a parallel algorithm processors may be ne

Define addressing modes, Define addressing modes. The dissimilar ways i...

Define addressing modes. The dissimilar ways in which the location of an operand is specified in an instruction are referred to as addressing modes.

Define interrupt, Define interrupt. An interrupt is any exceptional eve...

Define interrupt. An interrupt is any exceptional event that causes a CPUU to temporarily transfer control from its present program to another program , an interrupt handler th

Describe the lists used in html, Q. Describe the LISTS used in html? Li...

Q. Describe the LISTS used in html? Lists are used when data are to be mentioned in form of points such as: causes of a particular issue, list of items etc. Lists break up mono

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