Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Integer temp = new Integer(0);
- for (int k = 0; k < 200; ++k) { // this function creates 200 unique strings and
- s = (new Integer(k)).toString(); // inserts them into the hash table
- h.insert("R"+s+"C"+s);
- }
- boolean fail = false;
- for (int k = 0; k < 200; ++k) { // this function tries to find each string that
- s = (new Integer(k)).toString(); // was inserted into the hash table
- if (!h.find("R"+s+"C"+s) ) {
- fail = true;
- }
- }
- public boolean find(String key) {
- String stringKey = key;
- int hashToFind;
- StringHashCode sH = new StringHashCode(arraySize);
- hashToFind = sH.giveCode(stringKey);
- if ( HashTable[hashToFind] == stringKey) { // this is where the method checks whether
- // or not the place in the hash table matches
- // the string we're trying to find
- System.out.println(stringKey + " was found in index " + hashToFind);
- return true;
- } else {
- return findDoubleHash(hashToFind, key);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement