Question

Java Implement one of the hashing procedures that we have discussed, and the following related functions:...

Java

Implement one of the hashing procedures that we have discussed, and the following related functions:

  • INSERT (item)
  • DELETE (item)
  • FIND (item)

Make sure that your program correctly handles collisions and full hash table!

Homework Answers

Answer #1
import java.util.*;

class hashSetEg {
        public static void main(String args[]) {
                HashSet<String> set = new HashSet<>();

                //Insert elements into Hashset
                set.add("John");
                set.add("Alex");
                set.add("Alice");
                set.add("Bob");
                set.add("Smith");
                System.out.println("Set is- "+set);


                //Delete element from Hashset
                set.remove("Alice");
                System.out.println("After delete the element set is- "+set);

                //Find the element from Hashset
                if(set.contains("Bob")) {
                        System.out.println("Finded!");
                }


        }
}
Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
I NEED A JAVA PROGRAM TO IMPLEMENT THE CONCEPT OF INDEX, if we have an DB...
I NEED A JAVA PROGRAM TO IMPLEMENT THE CONCEPT OF INDEX, if we have an DB file has a records of students number and names like this (Student file) stNum**stName 1 jack 2 maya 3 sam 4 alex 5 jane . . . . . . this file may have a thousands records, if we want to search for a specific record(student), we need to find it by (Index file), in this index file we have this (Index file) stNum**Address...
Using Java: implement a program with the following features. Thanks Produce a menu for the user...
Using Java: implement a program with the following features. Thanks Produce a menu for the user with 3 choices. Add a new user Attempt login See all users If the user chooses #1, prompt them for a username (a string). Then a password (a string). Using SHA-2 hash the password they gave you, and store the resulting username and hashed password in a datastructure of your choice. (It can be 2 arrays, one for usernames, one for hashed passwords). If...
Given the following specifications for an array-based unsorted list, implement all of the functions (declared below)...
Given the following specifications for an array-based unsorted list, implement all of the functions (declared below) and a write a driver code to test all of your implementations. // Define a structure to use as the list item struct ListItem { int key; int Data; }; #define MAX_SIZE 50 // Define maximum length of the list class UnsortedArray { private: int head; // Index to head of the list ListItem theList[MAX_SIZE]; // The list public: UnsortedArray(); // Class constructor ~...
Write a program that does the following. *Java Code* • Create an instance of the Hashtable...
Write a program that does the following. *Java Code* • Create an instance of the Hashtable class from the Java API • Make the initial table size of the hash table 1000 and the load factor 0.75 (which has been shown experimentally to be optimal). • Create an instance of the AVLtree class attached to this homework. • Measure the running time of adding various numbers of entries (as required by the table below) to the hash table and the...
Make Java program with the following tasks: 1. Create a new database called DTCC 2. Create...
Make Java program with the following tasks: 1. Create a new database called DTCC 2. Create a table called Students in the DTCC database with the following fields:     Student_ID    CHAR (10) ** make sure to set this field as the primary key     LastName      CHAR(20)     FirstName     CHAR(15)     PlanOfStudy CHAR(25)     GPA               Double 3. Insert 5 records into Students table: 899090111    Rothlisberger   Ben          CIT                                       3.7 129020202    Manning          Peyton     Computer Programming       3.8 890101030    Brady               Tom         Accounting                           3.4 980191919    Rodgers           Aaron       Networking                          3.2...
JAVA: Design and implement a recursive version of a binary search.  Instead of using a loop to...
JAVA: Design and implement a recursive version of a binary search.  Instead of using a loop to repeatedly check for the target value, use calls to a recursive method to check one value at a time.  If the value is not the target, refine the search space and call the method again.  The name to search for is entered by the user, as is the indexes that define the range of viable candidates can be entered by the user (that are passed to...
1.Consider a hard drive with an average seek time of 9 ms. Its disk spins at...
1.Consider a hard drive with an average seek time of 9 ms. Its disk spins at 7200 rpm. What’s the average access time? In your answer, ignore the drive transfer time and any controller overhead. 2.Suppose that we are using extendable hashing on a file that contains records with the following search-key values: (2, 3, 5, 7, 11, 17, 19, 23, 29, 31). Show the final extendable hash structure for this file if the hash function is h(x) = x...
This semester we have discussed the following statistical analyses.               Z-test               One-Sample
This semester we have discussed the following statistical analyses.               Z-test               One-Sample t-test                    Independent Groups t-test                   Repeated Measures t-test One-Way ANOVA                 Repeated Measures ANOVA             Correlation Fill in the table with the correct defining term. ? is given µ is given Groups Compared Test Used No No Looks at the same group at 2 different times or across two different conditions Yes Yes Sample against population X X Examines the degree to which two variables relate to one another...
C PROGRAMMING Doubly Linked List For this program you’ll implement a doubly linked list of strings....
C PROGRAMMING Doubly Linked List For this program you’ll implement a doubly linked list of strings. You must base your code on the doubly linked list implementation given in my Week 8 slides. Change the code so that instead of an ‘int’ each node stores a string (choose a suitable size). Each node should also have a next node pointer, and previous node pointer. Then write functions to implement the following linked list operations: • A printList function that prints...
Design a pseudocode program that loads an array with the following 7 values. Add one more...
Design a pseudocode program that loads an array with the following 7 values. Add one more word (of your own choosing) for a total of 8 words. biffcomelyfezmottleperukebedraggledquisling Be sure to use lowercase, as shown above. This will make the processing easier. • Ask the user to enter a word • Search through this array until you find a match with the word the user entered. • Once you find a match, output "Yes, that word is in the dictionary"....
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT