Hash 8 randomly generated int values (in the range [ 099] inclusive). The random number generator...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Hash 8 randomly generated int values (in the range [ 099] inclusive). The random number generator is initially seeded to value 97. Each generated value is stored in a hash table size 11. The first hash function, h1(key) is the division modulo sizeof(table). I.e., hl (key)=key sizeof (table) hl(key)= key % 11. You will use double hashing to resolve collisions. The second hash function is h2 (key) = N(key & N), where N is largest prime < sizeof(table) h2 (key)= 7 - (key % 7). The hash table is an array size 11 of ints. The output: For each value generated, output: the value, final location where data is stored. After all values are hashed, print the table's contents. Constraints: (1) Use exactly one random number generator. (2) Duplicate data is permitted. (3) Only one Java file. (4) Include the standard header. (5) Minimal (or no) comments. Grade based on: (1) Correct functioning. (2) Good readability. (3) Good style, alignment, variable names, etc. Hash 8 randomly generated int values (in the range [ 099] inclusive). The random number generator is initially seeded to value 97. Each generated value is stored in a hash table size 11. The first hash function, h1(key) is the division modulo sizeof(table). I.e., hl (key)=key sizeof (table) hl(key)= key % 11. You will use double hashing to resolve collisions. The second hash function is h2 (key) = N(key & N), where N is largest prime < sizeof(table) h2 (key)= 7 - (key % 7). The hash table is an array size 11 of ints. The output: For each value generated, output: the value, final location where data is stored. After all values are hashed, print the table's contents. Constraints: (1) Use exactly one random number generator. (2) Duplicate data is permitted. (3) Only one Java file. (4) Include the standard header. (5) Minimal (or no) comments. Grade based on: (1) Correct functioning. (2) Good readability. (3) Good style, alignment, variable names, etc.
Expert Answer:
Answer rating: 100% (QA)
import javautilRandom public class Hashing int hashTable n... View the full answer
Related Book For
Statistics The Art and Science of Learning from Data
ISBN: 978-0321755940
3rd edition
Authors: Alan Agresti, Christine A. Franklin
Posted Date:
Students also viewed these programming questions
-
A random number generator is used to generate a real number between 0 and 1, equally likely to fall anywhere in this interval of values. (For instance, 0.3794259832 c is a possible outcome.) a....
-
Suppose that we use double hashing to resolve collisionsthat is, we use the hash function h(k, i) = (h 1 (k) + ih 2 (k)) mod m. Show that if m and h 2 (k) have greatest common divisor d 1 for some...
-
A hash table of size m is used to store n items, with n m/2. Open addressing is used for collision resolution. a. Assuming uniform hashing, show that for i = 1, 2, ..., n, the probability that the...
-
What is the output after executing the following Java statements? for (int i-2; i <3; i++) for (int j-2; j <4; j++) System.out.print ((i+j) + " ");
-
The Heating Division of Kobe International produces a heating element that it sells to its customers for $45 per unit. Its variable cost per unit is $25, and its fixed cost per unit is $10. Top...
-
It takes a word processor 30 minutes to word process and spell check 4 pages. 1. Find how many pages she can word process and spell check in 4.5 hours. 2. If the school accepted 10 students, find how...
-
Brian Rafferty ingested finasteride, a drug prescribed to him to treat an enlarged prostate. Finasteride is a generic version of Proscar, a drug manufactured by Merck. Some time after he started to...
-
Paige Corporation makes a mechanical stuffed alligator that sings the Martian national anthem. The following information is available for Paige Corporations anticipated annual volume of 500,000...
-
You are the owner of Poptastic. For the past few years, to help supplement your familys income, you have sold premium, homemade popsicles from your food truck and a few local businesses in Pensacola,...
-
1) Use the base case assumptions as well as the information presented in the case to build a four-year discounted cash flow model for Advanced Seal given a 50% cannibalization rate for the Premium...
-
Alberto Corelli offers to pay $2,500 to purchase a painting titled Moonrise from Tara Shelley, an artist whose works have been causing a stir in the art world. Shelley accepts Corelli's offer....
-
Assuming Just Right Services' fiscal year (FY) runs from January 01 to December 31 each year, which months have actual balances to compare to the operating budget thus far for FY 2021?
-
Please reflect on your experiences with COUN 501 microskills group. Share your experience in your microskills group related to unresolved personal issues that were triggered within the group. 2....
-
Find what you believe is an effective video/oral or oral marketing ad on the web. Provide the link as a part of this response. Utilizing concepts of marketing as context, provide your thoughts as to...
-
How do corporations make financial disclosures about the corporation at the end of the financial year? Who benefits from this disclosure? At the end of the financial year, a corporation has to make a...
-
The importance of effective management and leadership in the context of modern business practices and operations. Why are these principles and characteristics so important to the success of a...
-
Considering the wars, terrorist attacks, and other violations of international law around the world, discuss the function of international law in regulating the relations between sovereign nations in...
-
Apply Jacobis method to the given system. Take the zero vector as the initial approximation and work with four-significant-digit accuracy until two successive iterates agree within 0.001 in each...
-
When we use a recent GSS and regress y = number of hours per day watching TV on g = gender (1 = male, 0 = female) and religious affiliation (r1 = 1 for Protestant, r2 = 1 for Catholic, r3 = 1 for...
-
Example 2 of this chapter discusses an exit poll taken during the 2010 California gubernatorial election. The administrators of the poll also collected demographic data, which allows for further...
-
For the FL Student Survey data file on the text CD, the correlation between y = political ideology (scored 1 = very liberal to 7 = very conservative) and x = number of times a week reading a...
-
This chapter suggests that estimating project costs is a challenging process that can resemble an art form as much as science. Describe the different methods used to estimate costs on a project. How...
-
Consider the common problems with project cost estimation and recall a project with which you have been involved. Which of these common problems did you encounter most often? Why?
-
Explain the concept of activity-based costing. What are the steps involved in this process?
Study smarter with the SolutionInn App