Java
Implement one of the hashing procedures that we have discussed,
and the following related functions:
Make sure that your program correctly handles collisions and full hash table!
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!");
}
}
}
Get Answers For Free
Most questions answered within 1 hours.