bartleby

Concept explainers

Question
Book Icon
Chapter 27, Problem 27.2PE
Program Plan Intro

MyMap using Open Addressing with Quadratic Probing

Program Plan:

  • Define a class named “Sample” to implement MyMap using open addressing with quadratic probing.
    • Define function main.
      • Define an integer HashMap named “map”.
      • Put ‘2, 2” into the map.
      • Remove “2” from the map.
    • Define a static class named “MyHashMap” and implement “MyMap”.
      • Define required variables.
      • Define a function named “MyHashMap”.
        • Construct a map with the default capacity and load factor.
      • Define a function named “MyHashMap” with one parameter.
        • Construct a map with the specific initial capacity and default load factor.
      • Define a function named “MyHashMap” with two parameters.
        • Construct a map with the default capacity and load factor.
      • Define a function named “clear”.
        • Remove all of the entries from this map.
      • Define a function named “containsKey”.
        • Return true if the specified key is in the map.
      • Define a function named “containsValue”.
        • Return true if this map contains the specific value.
      • Define a function named “entrySet”.
        • Return a set of entries in the map.
      • Define a function named “get”.
        • Return the first value that matches the specific key.
      • Define a function named “getAll”.
        • Return all values for the specified key in this map.
      • Define a function named “isEmpty”.
        • Return true if this map contains no entries.
      • Define a function named “keyset”.
        • Return a set consisting of the keys in this map.
      • Define a function named “put”.
        • Add an entry (key, value) into the map and return the value.
      • Define a function named “remove”.
        • Remove the element for the specific key.
      • Define a function named “size”.
        • Return the number of mappings in this map.
      • Define a function named “values”.
        • Return a set consisting of the values in this map.
      • Define a function named “hash”.
        • Return “hashCode % capacity” value.
      • Define a function named “supplmentHash”.
        • Ensure the hashing is evenly distributed and return the result.
      • Define a function named “removeEntries”.
        • Remove all entries from each bucket.
      • Define a function named “rehash”.
        • Rehash this map.
      • Define a function named “toString”.
        • Return a string representing for this map.
    • Define an interface name “MyMap”.
      • Declare function prototypes for the functions which are created at the class “MyHashMap”.

Blurred answer
Students have asked these similar questions
make a screen capture showing the StegExpose results
Which of the following is not one of the recommended criteria for strategic objectives? Multiple Choice   a) realistic   b) appropriate   c) sustainable   d) measurable
Management innovations such as total quality, benchmarking, and business process reengineering always lead to sustainable competitive advantage because everyone else is doing them. a) True b) False

Chapter 27 Solutions

MyLab Programming with Pearson eText -- Access Card -- for Introduction to Java Programming and Data Structures, Comprehensive Version

Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
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
New Perspectives on HTML5, CSS3, and JavaScript
Computer Science
ISBN:9781305503922
Author:Patrick M. Carey
Publisher:Cengage Learning
Text book image
Systems Architecture
Computer Science
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Cengage Learning
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