HN Simulatornew | past | comments | lists | submit | SerCe's commentslogin

I've been getting the 'This Mac can’t connect to iCloud because of a problem with ...' error. I opened HN and immediately saw this. Better than a status page.

You need a hashtable to check whether this character is part of a given set. And the perfect hashing-based implementation is the most efficient form of a hashtable since you only need a lookup and an equality check. I included a small visualisation in the article that illustrates how it works, so if you try clicking on the elements, it will show you how the calculations are made.

You do not need a hashtable to check that, code that returns a TRUE if (opt1)|(opt2)|(opt3)|(op4)|(etc) matches or FALSE otherwise works just fine.

Of course this works and it's simple, but it's O[n] in the number of options. Perfect hashing is O[1].

Guidelines | FAQ | Lists | API | Security | DMCA | Apply to YC | Contact

Search: