This was asked today in interview any pointer.

"Design a unique hash function for every tweet in Twitter"

+1 vote

This was asked today in interview any pointer.

"Design a unique hash function for every tweet in Twitter"

+1 vote

What you need is hash function which takes input as string and userhandle (original person who tweeted the matter). Rest is simple (handle the collision in the hash) -

Modified sdbm

```
static unsigned long sdbm(unsigned char *tweet, unsigned char *handle)
{
unsigned long hash = 0;
int c;
while (c = *tweet++)
hash = c + (hash << 6) + (hash << 16) - hash;
while (c=*handle++)
hash = c + (hash << 6) + (hash << 16) - hash;
return hash;
}
```

...

Finding the unique hash function ? I don't think so if yes please let me know.