MicrolearnENPTES

Hash tables

Lesson 11 of 20 · Algo.Micro

Turn a key into a position and find things in O(1) on average.

A hash function turns a key into a number. Here: add the character codes and take the remainder by 7, the number of buckets. "dog" → 314 → bucket 6.

Check yourself

What does a hash function do in a hash table?

Do it in the browser: a real algorithms tool, a short mission and instant feedback. No install.

Start this lesson — free
← QueuesHeaps and priority queues →

All lessons · Algo.Micro