Algorithm Analysis (CSC 301 2015F) : Outlines

Outline 09: Hash Tables


Held: Wednesday, 16 September 2015

Back to Outline 08 - Roles of Data Structures and Abstract Data Types. On to Outline 10 - An Introduction to Trees.

Summary

We consider hash tables, one of the more popular implementations of the dictionary ADT.

Related Pages

Overview

Administrivia

Upcoming Work

Extra Credit

Academic

Peer

Review of Hash Tables

With your group

Hash Functions

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 ...