This code uses separate chaining

Assignment Help Basic Computer Science
Reference no: EM13163630

This code uses separate chaining ...implement it using double hashing. Implement a separate-chaining table in which each integer x is hashed twice using two different hash functions h1(x) and h2(x). This will perhaps produce two different locations for x. Place x in the location that has the smaller chain.

public static void interactiveMode(Scanner input) {
   int menuChoice = 0;
   do {
   System.out.println("\nInteractive Mode:");
   System.out.println("1. Enter size of table");
   System.out.println("2. Enter an integer");
   System.out.println("3. Find integer");
   System.out.println("4. Exit to Main Menu.");
   System.out.print("Please enter a selection: ");

   menuChoice = input.nextInt();
   input.nextLine();
   System.out.println();
   switch (menuChoice) {
   case 1:
   System.out.print("Enter size of table: ");
   int n = input.nextInt();
   size=n;
   a = new ArrayList[size];
   for (int i = 0; i < size; i++) {
   a[i] = new ArrayList<Integer>();
   }
   print();
   break;
   case 2:
       System.out.println("Enter an integer for the table");
      
       int m = input.nextInt();
       int index = m % size;
       a[index].add(m);
       print();
       break;
   case 3:
   System.out.print("Enter an integer to find: ");
   int search = input.nextInt();
   if (find(search)) {
   System.out.println("Integer " + search + " is in the table.");
   }
   else {
   System.out.println("Integer " + search + " is not in the table.");
   }
   break;
   default:
   if (menuChoice != 4) {
   System.out.println("Enter correct number.");
   }
   break;
   }
   } while (menuChoice != 4);
   }

Reference no: EM13163630

Questions Cloud

Trigger named products_insert : Create a trigger named Products_INSERT that inserts the current date for the DateAdded column of the Products table if the value for that column is null. Test this trigger with an appropriate INSERT statement.
Write a java binary search tree program : write a JAVA binary search tree program
Create an array of integers at random : create an array of integers at random with a range of 0 through 1000 in Java... any hints?
Trigger named products_update : Create a trigger named Products_UPDATE. This trigger should insert the old data about the product into the ProductsAudit table after the row is updated. Then, test this trigger with an appropriate UPDATE statement.
This code uses separate chaining : This code uses separate chaining ...implement it using double hashing. Implement a separate-chaining table in which each integer x is hashed twice using two different hash functions h1(x) and h2(x). This will perhaps produce two different location..
Recall that a computer virus is malware : Recall that a computer virus is malware that relies on someone or something (other than itself) to propagate from one system to another. Write a computer virus that can be written to other empty text documents by running the batch program.
Atmega128 is being used to monitor humidity inside test cham : Atmega128 is being used to monitor humidity inside test chamber 03. The device uses two sensors to have some fault tolerance. They are connected to ADC channels 0 and 1. The program uses the average and maximum error of the two values.
The time delay of a long-distance : The time delay of a long-distance call can be determined by multiplying a small fixed constant by the number of communication links on the telephone network between the caller and callee
Write a function to compute the magnitude f : write a function to compute the magnitude F and direction angle of a two-dimensional force F by using two components of the force fx,fy as its parameters,returning F and using the reference to pass theta value .

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

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