Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
11th Edition
ISBN: 9780134670942
Author: Y. Daniel Liang
Publisher: PEARSON
Question
Book Icon
Chapter 27, Problem 27.11PE
Program Plan Intro

Set operations in MyHashSet

Program Plan:

  • Include a class name named “Exercise_11”.
    • Import util package.
    • Declare the main() method.
    • Declare constructor.
    • Create array for string names.
    • Take user inputs and add into respective arrays.
    • Create new Hashset.
    • Add elements from set1 into set2.
    • Remove all elements present in set1 from set 2.
    • Retain elements present in set2 and set1.
    • Check if set1 and set2 contains same elements.
    • Close the main() method.
    • Close the class.
  • Include a static class “MyHashSet”.
    • Define the default hash table size. Must be a power of 2.
    • Define the maximum hash table size. 1 << 30 is same as 2^30.
    • Declare current hash table capacity. Capacity is a power of 2.
    • Define default load factor.
    • Specify a load factor threshold used in the hash table.
    • Declare a Hash table that is an array with each cell that is a linked list.
    • Declare a constructor to Construct a set with the default capacity and load factor.
    • Declare a constructor to Construct a set with the specific capacity and load factor.
    • Declare an override method that Remove all elements from this set.
    • Declare an override method that Return true if the element is in the set.
    • Declare an override method that adds an element to the set.
    • Create a linked list for the bucket if it is not created.
    • Declare an override method that Remove the element from the set.
    • Declare an override method that Return the number of elements in the set.
    • Declare an override method to return the number of iterators.

Blurred answer
Students have asked these similar questions
(1 point) By dragging statements from the left column to the right column below, give a proof by induction of the following statement: an = = 9" - 1 is a solution to the recurrence relation an = 9an-18 with ao = : 0. The correct proof will use 8 of the statements below. Statements to choose from: Note that a₁ = 9a0 + 8. Now assume that P(n) is true for all n ≥ 0. Your Proof: Put chosen statements in order in this column and press the Submit Answers button. Let P(n) be the predicate, "a = 9″ – 1". απ = 90 − 1 = Note that Let P(n) be the predicate, "an 9" - 1 is a solution to the recurrence relation an = 9an-1 +8 with ao = 0." - Now assume that P(k + 1) is true. Thus P(k) is true for all k. Thus P(k+1) is true. Then ak+1 = 9ak +8, so P(k + 1) is true. = 1 − 1 = 0, as required. Then = 9k — 1. ak Now assume that P(k) is true for an arbitrary integer k ≥ 1. By the recurrence relation, we have ak+1 = ak+1 = = 9ak + 8 = 9(9k − 1) + 8 This simplifies to 9k+19+8 = 9k+1 − 1 Then 9k+1 − 1 = 9(9*…
Given the following request to an AI chatbot, which response is more accurate? (You should use Google to verify that the factual claims in each response are accurate.)   Prompt Is this true? The first recorded use of the phrase "when pigs fly" in print is in a 1616 play by Ben Jonson called "The Devil is an Ass," in which a character says, "When pigs fly, good-night!!" Response   Response A Response B Yes, that's true! The phrase "when pigs fly" indeed appears in Ben Jonson's 1616 play The Devil is an Ass and was said during the second act in a conversation between Fitzdottrel and Pug. The phrase was first used to express skepticism or disbelief, suggesting that something is as unlikely to happen as the fanciful idea of pigs flying. This usage is often cited as one of the earliest instances of the phrase in print.   The claim that the phrase "when pigs fly" was first recorded in Ben Jonson's 1616 play "The Devil is an Ass" is not accurate. There is no evidence from the…
This is for my Computer Organization & Assembly Language Class
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Text book image
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:9781337508841
Author:Carey
Publisher:Cengage
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Text book image
CMPTR
Computer Science
ISBN:9781337681872
Author:PINARD
Publisher:Cengage