Prepare a java simulation program

Assignment Help JAVA Programming
Reference no: EM135145

Given a hash function h(key), prepare a java simulation program to determine each of the subsequent quantities after 0.8*tablesize random keys have been generated. The keys should be random integers. 

1. The percentage of integers between 0 and tablesize-1 that do not equal h(key) for some generated key. 

2. The percentage of integers between 0 and tablesize-1 that equal h(key) for more than one generated key. 

3. The maximum number of keys that hash into a single value between 0 and tablesize-1.  Run the program to test the uniformity of each of the following hash functions. 

A. h(key) = key%tablesize for tablesize a prime number.

B. h(key) = key%tablesize for tablesize a power of 2.

Notations and guidelines: 

  • tablesize is number of unique table indexes that the hash function generates. For example a function key%10 results in 10 unique numbers [0-9] for any valid integer key.
  • Based on the above point you must now realize that tablesize can be determined based on the hash function.
  • Remember that h(key) returns the table index.
  • Use Java's inbuilt random number generator to generate keys.
  • As h(key) returns table index, its return type should be of type int.

Data Structure Implementation: 

  • You must implement a list based hash table. (You must implement your own linked list, do not use Java's LinkedList class).
  • Use Separate Chaining method for resolving hash clash.
  • You can use the following node class definition towards your implementation:

Class Node { 

   int key; 

  int record; 

   Node nextNode; 

 

  • In the node class let your record member hold the value stored in key member.
  • Your FIRST STEP towards creating the data structure will be to create the bucket. Bucket is an array that holds Node objects. The size of bucket will be tablesiz,e recollect that tablesize can be determined based on your hash function as described earlier.
  • Remember that hash function returns the bucket index. Based on the index returned by hash function the record must be inserted accordingly.
  • Note that random number generator may return same number multiple times, so you must check if a key already exists. Insert they key only if it does not exist in the hash table.

Reference no: EM135145

Questions Cloud

Advise penguin whether they can take action against anna : In the context of the law of contract, advise Penguin Ltd whether they can take any action against Anna.
Salem management regarding tax implications : Prepare a memo to your CFO indicating the outcome of such a change on current taxes and outlining the needs for making this change and provide recommendation to Salem management regarding tax implications of this contribution.
Evaluate the correlation coefficient : Evaluate the correlation coefficient. Comment on the value of the correlation coefficient. Prepare an ANOVA table and attach the summary output.
Write a program that assigns seats on an airplane : Prepare a program that teaches arithmetic to a young child. The program tests subtraction and addition. Write a program that assigns seats on an airplane.
Prepare a java simulation program : Given a hash function h, prepare a java simulation program to determine each of the subsequent quantities after 0.8*tablesize random keys have been generated. The keys should be random integers.
Evaluating shear force and bending moment diagram : Sketch the shear force and bending moment diagram and Verify that the support reactions are correct.
Evaluate the shearing and normal stresses : Evaluate the shearing and normal stresses at points H and J located at the ends of the horizontal and vertical diameters of transverse section located 2.5 in. to the left of bearing B.
Calculate the amounts for the current year : Calculate the amounts for the current year. Calculate the amount and character of income distributed to each trust beneficiary for the year.
What is its velocity at impact : What is its velocity at impact? What will its average velocity be? What will its average speed be.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Mvc pattern and servlet

When you use the MVC pattern, the controller directs the flow of control to

  Cascading style sheet to a website

Compare and contrast the process of adding JavaScript and a Cascading Style Sheet to a Website. Determine if they can be used simultaneously in a page.

  Write a program that reads a set of floating-point

Write a program that reads a set of floating-point data values from the input.

  Compute area and perimeter of a polygon

Create a project that would let a user compute area and perimeter of a polygon

  World data app

Prepare WorldDataApp project. It implements the NameIndex portion, including creating it in SetupProgram, and searching, viewing and updating it in UserApp program.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  The frantic pipe layer game

Design the Frantic Pipe Layer game

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  File integrity checker - tripwire

Write a program that will perform some of the basic tasks accomplished by a file integrity checker such as Tripwire.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd