Data Structure Assugnment
Data Structure Assugnment
Assignment Number 2
1. Implement a simple phone book using a hash table where keys are names and values
are phone numbers.
2. Implement basic operations such as insert, delete, search, and update in has tables.
3. Explain what a hash function is and how it converts keys into indices for hash tables.
4. Provide an example of a basic hash function and discuss its properties.
5. Define what collision is in the context of hash tables and how it is handled.
6. Explain one method to handle collisions, such as chaining (using linked lists).
7. Given a string, find the first unique character using a hash map to store character
frequencies.
8. Provide a step-by-step approach and discuss the time complexity of your solution.
9. Given an array of integers and a target sum, find pairs that sum up to the target using
a hash set.
10. Outline the approach using a hash set for efficient lookups and discuss its time
complexity.