Question: 2. Given the following Hash Table implementation, write the put() method. public class Linear ProbingHashST { } private int M = 30001; private Value
2. Given the following Hash Table implementation, write the put() method. public class Linear ProbingHashST { } private int M = 30001; private Value [] vals = (Value []) new Object [M]; private Key [] keys = (Key []) new Object [M]; private int hash (Key key) public void put (Key key, Value val) {...} public Value get (Key key) { } for (int i=hash (key); keys [i] != null; i = (i+1) % M) if (key.equals(keys [i])) return vals[i]; return null;
Step by Step Solution
3.40 Rating (153 Votes )
There are 3 Steps involved in it
Heres the put method implementation for the given Linear Probing Hash Table public void p... View full answer
Get step-by-step solutions from verified subject matter experts
