How would you implement a hashtable in language x?

Posted by mk on Stack Overflow See other posts from Stack Overflow or by mk
Published on 2008-08-24T18:58:16Z Indexed on 2010/05/25 2:21 UTC
Read the original article Hit count: 249

The point of this question is to collect a list of examples of hashtable implementations using arrays in different languages. It would also be nice if someone could throw in a pretty detailed overview of how they work, and what is happening with each example.

Edit:

Why not just use the built in hash functions in your specific language?

Because we should know how hash tables work and be able to implement them. This may not seem like a super important topic, but knowing how one of the most used data structures works seems pretty important to me. If this is to become the wikipedia of programming, then these are some of the types of questions that I will come here for. I'm not looking for a CS book to be written here. I could go pull Intro to Algorithms off the shelf and read up on the chapter on hash tables and get that type of info. More specifically what I am looking for are code examples. Not only for me in particular, but also for others who would maybe one day be searching for similar info and stumble across this page.

To be more specific: If you had to implement them, and could not use built-in functions, how would you do it?

You don't need to put the code here. Put it in pastebin and just link it.

© Stack Overflow or respective owner

Related posts about arrays

Related posts about language-agnostic