Oracle Interview Question
Site Reliability EngineersTeam: GGN
Country: India
Interview Type: In-Person
there is one hashset class in java already available.
So interviewer wanted me to design own hashset class,he did not mention whether he want same hashset or want to see some new class which can do the same functionality.
he wants u to write an implementation as:
1. Write a hash function as:
unsigned int Hash(int num) {
return num * 63563 % MAXBUCKET;
}
2. Insert into buckets according to hash value and maintain a link list at the point of collision,
If u want i can write a code for it (but in C language as i'm much more comfortable in C)
unsigned long and arrays (hash values equal to number of buckets which is fixed by MAXBUCKETS)
It could be an array of linked lists.
. Each array index will be mapped with a hash value. Each array index holds the head of a linked list.
. If hash value is same for more than 1 element then they are appended to the linked list on that array index. Then we have to use equals() method to identify the correct element.
Can u descibe the question more?
- Siddharth Das July 06, 2012Does it want an implementation oh hashing technique?