CSC161 2010F Imperative Problem Solving
[Skip to Body]
Primary:
[Front Door]
[Schedule]
-
[Academic Honesty]
[Instructions]
Current:
[Outline]
[EBoard]
-
[Assignment]
[Lab]
Groupings:
[EBoards]
[Assignments]
[Examples]
[Exams]
[Handouts]
[Labs]
[Outlines]
[Readings]
Related Courses:
[CSC195 2003S (Rebelsky)]
[CSC161 2009F (Coahran)]
[CSC161 2010S (Walker)]
Misc:
[SamR]
[ISO]
[GNU Coding Standards]
Summary:
Prerequisites: Familiarity with structs and pointers. Familiarity with the dictionary data type.
a. Create a new directory for this lab. I'd suggest Labs/Hashtables
, but you can choose whatever you'd like.
b. Copy the code from Examples/Hashtables.
c. Review the code to ensure that you understand what's happening.
a. Find two keys that give the same index in a size 20 hash table.
b. Add a unit test to verify that the hash table performs correctly if we use both of those keys. In particular, you should verify that if both keys have different values, they retrieve the different values.
Write a procedure, dump (hashtable *table)
, that prints
all of the key/value pairs in the table.
Note: You can't easily unit test this procedure, so you may just want to add a dump at the end of your unit tests.
Traditionally, we use a hash table to look up values by key. But we could
try the reverse, too. Write a function, char *find_key (hashtable *table, char *value)
, that returns one key that maps to value
.
If no such key exists, return null.
Sketch an algorithm for deleting a key from the hash table.
[Skip to Body]
Primary:
[Front Door]
[Schedule]
-
[Academic Honesty]
[Instructions]
Current:
[Outline]
[EBoard]
-
[Assignment]
[Lab]
Groupings:
[EBoards]
[Assignments]
[Examples]
[Exams]
[Handouts]
[Labs]
[Outlines]
[Readings]
Related Courses:
[CSC195 2003S (Rebelsky)]
[CSC161 2009F (Coahran)]
[CSC161 2010S (Walker)]
Misc:
[SamR]
[ISO]
[GNU Coding Standards]
Disclaimer:
I usually create these pages on the fly
, which means that I rarely
proofread them and they may contain bad grammar and incorrect details.
It also means that I tend to update them regularly (see the history for
more details). Feel free to contact me with any suggestions for changes.
This document was generated by
Siteweaver on Mon Nov 22 09:32:17 2010.
The source to the document was last modified on Mon Nov 22 09:32:14 2010.
This document may be found at http://www.cs.grinnell.edu/~rebelsky/Courses/CSC161/2010F/Labs/hash-table-lab.html
.
A PDF version of this document may be found at
http://www.cs.grinnell.edu/~rebelsky/Courses/CSC161/2010F/Labs/hash-table-lab.pdf