Data Structures
HONOR CODE
COMP-3040-02
Data Structures
Assignment-5
Soft-Copy due on 10/16/2018 11:30 pm Hard-Copy due on 10/17/2018 in class
I pledge my honor that I have neither given nor received aid on this work.
Do not sign until after you have completed your assignment.
Name: Signature:
1. Given the keys 77 40 16 98 10 30 80 44 22 1 26
Fill in the hash table by using the hash function h(i) = (2i+5)mod 11 and handling collisions using linear
probing f(i) = i
2. Do the same but use quadratic probing with f(i) = 𝑖2
3. Do the same but use double hashing and the second hash function being h2(k) = 7-(k mod 7).
4. Do the same but use separate chaining
5. In question 4, change the table size to 5, what is the output?
6. Programming
Modify the program so that you can Insert/search/delete employee objects. Note, you may need to
include program P2-1(SingleLinkedList) and Linkedlist Node class in your project, and modify them.
The class Student is given as below: public class employee
{
public int id;
public String name;
public double salary;
public void Input()
{
System.out.println("Enter name: ");
name = new Scanner(System.in).nextLine();
System.out.println("Enter ID: ");
id = Integer.parseInt(new Scanner(System.in).nextLine());
System.out.println("Enter Salary: ");
salary = Double.parseDouble(new Scanner(System.in).nextLine());
}
public void Output()
{
System.out.printf("Name: %1$s, ID: %2$s, Grade: %3$s ", name, id, salary);
}
public String toString()
{
return String.format("[Name: %1$s, ID: %2$s, Grade: %3$s]", name, id, salary);
}
}
Submission Requirements: As before.