you're storing information about the users of a web-based application, which is to say that each user has a username that is a string of uppercase letters, lowercase letters, and digits. let's imagine that the most common operations are to add a new user to the application and to check whether a user already exists (given a username). A hash table would be an appropriate way to solve this problem because you know that a well-chosen hash function can lead to something akin to Θ(1) lookups and amortized Θ(1) insertions - suppose that you've chosen a hash function that sums the character codes associated with the characters in the username. Is the chosen hash function a good hash function?
you're storing information about the users of a web-based application, which is to say that each user has a username that is a string of uppercase letters, lowercase letters, and digits. let's imagine that the most common operations are to add a new user to the application and to check whether a user already exists (given a username).
A hash table would be an appropriate way to solve this problem because you know that a well-chosen hash function can lead to something akin to Θ(1) lookups and amortized Θ(1) insertions -
suppose that you've chosen a hash function that sums the character codes associated with the characters in the username.
Is the chosen hash function a good hash function?
Trending now
This is a popular solution!
Step by step
Solved in 3 steps