Blazing Fast Lookup With Hash Tables


Exercises for Chapter #7 of A Common-Sense Guide To Data Structures and Algorithms

Get The Book!

Chapter Exercises


Exercise #1

Assume that we have a hash table with a superb load factor, which means that on average, there's only one piece of data in each cell. Describe in Big O Notation the efficiency of:

  1. Reading from the hash table.
  2. Inserting into the hash table.
  3. Deleting from the hash table.

Exercise #2

While we mentioned that an ideal load factor is 0.7, I’ve seen others say that 1 is an ideal load factor. If we followed this new advice, and we wanted to store 100 key/value pairs in a hash table, how many cells should it have?

Exercise #3

If we had a hash function that distributes data evenly, and a load factor of 3, how many key/values would be stuffed into each cell on average?

Let's Get In Touch!


Join the forum on The Pragmatic Programmers website to join in on the conversation about this book, or email Jay Wengrow, author of the book and this website directly.