Programming > Research Paper > University of Texas, Dallas - CS 3345LinearProbingHashTable (All)
/* * CS 3345.007 * Greg Ozbirn * Project 3 - Linear Probing Hash Table * Name: Ihfaz Tajwar * */ //LinearProbingHashTable class public class LinearProbingHashTable <K,V> { private static final ... int SIZE = 11; //Starting off with a default table size of 11 private int numElements; //Determines number of elements in the table //Entry class private static class Entry <K,V> { public K key; public V value; public boolean delStatus; //True if deleted //Constructor public Entry(K k, V v){ key = k; value = v; delStatus = false; } } Entry <K,V>[] table = new Entry[SIZE]; //Creation of the Hash Table //Constructor public LinearProbingHashTable(){ numElements = 0; for(int i = 0; i < table.length; i++) //Make table logically empty table[i] = null; } /******************* * HELPER METHODS * ********************/ //Determines the next number which is prime private int nextPrime(int input){ int counter; input++; while(true){ counter = 0; for(int i = 2; i <= Math.sqrt(input); i ++) if(input % i == 0) counter++; if(counter == 0) return input; else{ input++; continue; } } } /************** * METHODS * **************/ //Add entries to the hash table [Show More]
Last updated: 3 years ago
Preview 1 out of 5 pages
Buy this document to get the full access instantly
Instant Download Access after purchase
Buy NowInstant download
We Accept:
Can't find what you want? Try our AI powered Search
Connected school, study & course
About the document
Uploaded On
Mar 25, 2021
Number of pages
5
Written in
All
This document has been written for:
Uploaded
Mar 25, 2021
Downloads
0
Views
110
Scholarfriends.com Online Platform by Browsegrades Inc. 651N South Broad St, Middletown DE. United States.
We're available through e-mail, Twitter, Facebook, and live chat.
FAQ
Questions? Leave a message!
Copyright © Scholarfriends · High quality services·