Pergunta de entrevista da empresa Amazon

Implement a reverse hash table

Respostas da entrevista

Sigiloso

30 de jul. de 2013

As a way to make it as space-conserving as possible, the key->value pair can be inserted at the hashes of both the key and value. This would allow you to both differentiate a forward and reverse lookup, and use only a single additional pointer of space per entry.

1

Sigiloso

2 de abr. de 2013

This was easy enough but I somehow had seen this done with just one hash table and that isn't really possible. Should have gone with the simple, direct approach and optimized later.

Sigiloso

12 de jul. de 2013

Can you be more precise regarding the meaning of a "reverse hash table"

Sigiloso

17 de jul. de 2013

Say its a table T like this: T[1] = "Bob" T[2] = "Sally" T[3] = "Greg" Then it should also be possible to do: T["Bob"] = 1 T["Sally"] = 2 T["Greg"] = 3 Keys can be values and values can be used as keys