Create an empty set a of integers obtain from the user

Assignment Help Computer Engineering
Reference no: EM131761404

Assignment

1. Implement a generic class Set(T) that maintains a set of items of generic type T using the class LinkedList(T) in the Java API. Your Set class must provide the following instance methods:

add: that adds a new item. (Ignore if already in the set.) remove: that removes an item. (Ignore if not in the set.)

membership: that returns true if a given item is in the set and false otherwise.

toString: that returns a string with the list of the items in the set.

(REMINDER: do not violate encapsulation, you can only use List methods.)

2. Write a testSet class with a main() method that tests all the operations of the Set class above. That is, create an empty set A of integers, obtain from the user some integers and store some in A, some in B, and some in both, display the set using toString(), obtain from the user some integers and remove them from A using remove(), display the set using toString(), obtain an integer from the user and check whether it is in A or not using membership() and display the result. (REMINDER: you can only store objects.)

3. Based on the big-O running time of each method, argue whether implementing with ArrayList would have been better or not. (A complete answer must include the big-O running time of all methods for each of the implementations. If you do not base your answer on the big-O running time, you get no points.)

4. Expand your class Set(T) with the following static methods, and expand your testSet class to test them.

union: that returns the union of two given sets.

intersection: that returns the intersection of two given sets. difference: that returns the difference between two given sets.

Reference no: EM131761404

Questions Cloud

Legitimate practice when conducting diversity training : Having someone experience what it is like to be a minority is a legitimate practice when conducting diversity training.
Identify the maturity date of the note : Bike.Com received a 10%, 90-day promissory note with a face amount of $12,000 from Cyber Company, Identify the maturity date of the note
Nominal rate of return on investment during the period : What is the nominal rate of return on this investment during the period, before inflation? [EXCEL Formula = RATE]
Percent of sample means of process : Within what values will 99.74 percent of sample means of this process fall, if samples of n = 12 are taken and the process is in control (random)?
Create an empty set a of integers obtain from the user : Create an empty set A of integers obtain from the user some integers and store some in A, some in B, and some in both, display the set using toString().
The real estate taxes is apportioned to and is deductible : the real estate taxes is apportioned to and is deductible by the seller
Calculate the cash payback on this investment : The machine is expected to generate net income of $3000 each year. The cash payback on this investment is
Costs and benefits of both debt and equity financing : Discuss the costs and benefits of both debt and equity financing, and the circumstances in which less or more of each variety of capital would benefit
Discuss factory labor costs : the Finishing Department used the remainder. Manufacturing overhead is assigned to departments on the basis of 160% of labor costs

Reviews

Write a Review

Computer Engineering Questions & Answers

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

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