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

  A jsp expression can contain any java expression

A JSP expression can contain any Java expression that evaluates to a

  Loops and files

Convert an algorithm using control structures into Java and write a while loop

  Distributed systems

Build robust, secure distributed systems using advanced programming techniques

  Simulate a simple multiuser computer system

Prepare a java program to simulate a simple multiuser computer system

  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..

  Build the gui layout of the game

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

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Java program to create a tree

Java program to create a tree, generate class - BottomUpTwoThreeFourTree, BottomUpTwoThreeFourTree,

  The frantic pipe layer game

Design the Frantic Pipe Layer game

  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.

  Design a course registration system

Create an application which represents a simplified course registration system using ArrayLists and HashMaps.

  Evaluate the rtas resource requirements

Design and implement a set of classes and interfaces and use them to evaluate the RTA's resource requirements.

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