O'Reilly logo

Learn C the Hard Way: A Clear & Direct Introduction To Modern C Programming by Zed A. Shaw

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Exercise 38. Hashmap Algorithms

There are three hash functions that you’ll implement in this exercise:

FNV-1a Named after the creators Glenn Fowler, Phong Vo, and Landon Curt Noll, this hash produces good numbers and is reasonably fast.

Adler-32 Named after Mark Adler, this is a horrible hash algorithm, but it’s been around a long time and it’s good for studying.

DJB Hash This hash algorithm is attributed to Dan J. Bernstein (DJB), but it’s difficult to find his discussion of the algorithm. It’s shown to be fast, but possibly not great numbers.

You’ve already seen the Jenkins hash as the default hash for the Hashmap data structure, so this exercise will be looking at these three new hash functions. The code for them is usually small, and it’s ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required