Amazon Interview Question
Software Engineer / DevelopersCan't we "void *" as argument to our function to accept all data type. The function should only store the provided data with indexing with the knowledge of the data type.
yeah, right.. V got to use void*..
And regd 2nd sub division, we got to implement get, put and other methods i believe! if we know the appln, we can go with customized hash methods.
Hashing is a way of indexing the data, to guarantee O(1) access in the average case.
- Messi February 09, 2011INT - mod
float - convert into int by multiplying by 10, then mod.
strings - convert to int assuming base 26
objects - convert to int base 128 and then mod(you can also consider only allowed objects)