TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Random Hash Functions (2012)

7 pointsby crawshawover 12 years ago

2 comments

cpresseyover 12 years ago
April's fools aside,<p>"m[NaN] = 1 always creates a new hash table element (since the key is unequal to any existing entry), reading m[NaN] never finds any data (same reason), and iterating over the hash table yields each of the inserted NaN entries."<p>This suggests to me an ADT that special-cases insert on the key: if it's not NaN, put it in a hash table, but if it is, tack it onto (say) a plain linked list. Lookup NaN fails, traversing the structure traverses both the hash table and linked list.<p>Might be a bit more code than a straight-up hash table, but definitely less weird than calling rand in the hash function. (To me.)
coderholicover 12 years ago
Posted on April 1st, 2012
评论 #5236277 未加载