- A Hash Table Is Defined Using An Array Of 900 Intnode References So That Collisions Can Be Handled By Using Chaining A 1 (99.96 KiB) Viewed 58 times
A hash table is defined using an array of 900 IntNode references, so that collisions can be handled by using chaining, a
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
A hash table is defined using an array of 900 IntNode references, so that collisions can be handled by using chaining, a
A hash table is defined using an array of 900 IntNode references, so that collisions can be handled by using chaining, as follows: public class Table { private int manyItems; //using manyItems is not mandatory private IntNode () keys; public Table() { keys new IntNode (900); manyltems = 0; private int hash (int key) { return key % 900; // other Table methods } Write Java code for the following Table methods below. You may assume that IntNode is a class that defines a singly-linked integer node with the methods getData, setData, getLink, setLink, and a default constructor. This problem has partial credit. However, if you write "don't grade" or leave the answer blank, we will not grade any of your work for this problem and you will receive 1 point for each part. (a) public void put (int key) Inserts the key into the appropriate "chain" of the hash table. You may assume that there w are no duplicate keys. (b) public boolean containsKey (int key) Returns true if the key is in the hash table, or false otherwise. or ALT+FN+F10 (Mac). !! ii T