Algorithms and OOD (CSC 207 2013F) : EBoards

CSC207.01 2013F, Class 46: Implementing Dictionaries with Hash Tables


Overview

Preliminaries

Admin

Questions on the Exam

Do you want more errata?

No. There's way too much as it is. And yes, you are up to one letter grade of extra credit. (I will, however, be capping scaled grades at A+.)

Are you going to penalize the bozos who turned in the prologue Friday, but after 5pm?

Why do you folks put me in these situations? What do you think I should do? The class decides that we should paint a big red P (for procrastinator) on their forehead.

If we borrow code from a homework assignment, should we cite our colleagues?

Yes.

Can you give me some hints on problem 1?

See the white board.

_Can we record you?

Only if you promise not to post to the InterWeb.

_What should we do if the thing to be removed is the last value?

Should be covered in case 01 or case 02.

An introduction to hash tables

Hash functions

An exercise

Hash your first name (in a table of size 30)

A: 1   F: 6   K: 11  P: 16  U: 21  Z: 26
B: 2   G: 7   L: 12  Q: 17  V: 22
C: 3   H: 8   M: 13  R: 18  W: 23
D: 4   I: 9   N: 14  S: 19  X: 24
E: 5   J: 10  O: 15  T: 20  Y: 25

SAMUEL: 19 + 1 + 13 + 21 + 5 + 12 = 71 => 11
WILLIAM: 23 + 9 + 12 + 12 + 9 + 1 + 13 = 79 => 19
FRED: 6 + 18 + 5 + 4 = 33 => 3

0:                  10:
1:                  11:
2:                  12:             22:
3:                  13:             23:
4:
5:
6:
7:
8:
9:

Hashing in Java

Handling collisions

Handling removal

Copyright (c) 2013 Samuel A. Rebelsky.

Creative Commons License

This work is licensed under a Creative Commons Attribution 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by/3.0/ or send a letter to Creative Commons, 543 Howard Street, 5th Floor, San Francisco, California, 94105, USA.