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

  Creating the gui for the game interface

A GUI-based application that allows a user to play a simple trivia game

  Compilation and Execution - JAVA problem

Style marks are based on how your submitted code looks. Remember that good code is easily readable (and understandable) by someone who did not write it. For assignments, you should also include your name, student number, what course this is, what ass..

  Design an abstract data type in java

Design an abstract data type in Java that represents a musical pitch

  Simulate a simple multiuser computer system

Prepare a java program to simulate a simple multiuser computer system

  Build the gui layout of the game

Build the Build the GUI layout of the game in java.

  Communication with an smtp server

Develop a graphical user interface based java program that can communicate with a real SMTP email server for sending emails

  Write a recursive program

Write a recursive program to compute the number of ways in which an integer k can be written as sum

  Design a single class that expresses the commonality

Design a single class that expresses the commonality of these concepts.

  Technical community blog

Write a blog article for a coding and technical community blog.

  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.

  Write a program to register students for a college

Students have names, addresses and courses. Implement the interface class RegisterStudent. RegisterStudent has one method, public boolean register, which returns the boolean value of true or false if the student is successfully registered for the ..

  Methods

Assignment describe the basic working of methods. How to write a method in java and how to call a method.

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