Algorithm Analysis (CSC 301 2015F) : EBoards

CSC301.01 2015F, Class 09: Hash Tables


Overview

Preliminaries

Admin

Upcoming Work

Extra Credit

Academic

Peer

HW2 Issues

Questions

Review of hash tables

What do you see as the key ideas of hash tables?

What are some design choices you have to make in implementing hash tables?

Hash functions, revisited

With your group

Function borrowed from Skienna p. 89; expects arbitrary-precision integers

#define alpha SOME_LARGE_PRIME
int hash(char *s)
{
  int len = strlen(s);
  int code = 0;
  for (int i = 0; i < len; i++)
    {
      code += s[i] * expt(alpha, len-(i+1))
    } // for
  return code;
} // hash

Other Uses of Hash Tables and Functions

Ideas stolen from Skiena

How could you use hash functions or tables to help you ...

Other uses of hash tables and hash functions