CS210 Lab: Hash Table Postlab
Postlab Exercise:
This postlab exercise is broken down into two parts:
- Part 1-general hash table question
- Part 2-lab exercise specific question
Part 1
For the following two questions, use the following values:
67 46 88 91 123 141 152 155 178 288 390 399 465 572 621 734
- Draw a diagram to show how the values are inserted into a hash table
with 20 positions. Use the
division method of hashing and the linear probing method
of resolving collisions.
- Draw a diagram to show how the values are inserted into a hash table
that uses the hash function key % 10
to determine into which of ten chains to put the value.
Part 2
This question is based on the lab exercise that you have just completed.
- When implementing programs that take passwords, you might want to hide
the user input, or display stars instead. You can do this using
a couple of functions:
- getch()--to get a character from the
console without echo.
(#include <conio.h>)
- You may have to use type casting or type conversion
to change the integer return from getch() into a
character.
- The following format should work:
(char)getch() or char(getch()).
- putchar('*')--to echo stars.
(#include <stdio.h>)
Look these up using "Help" and try to modify your code so that you
program will run something like the following:
Login: mary
Password: ********
Authentication successful
Login:
For Answers, click
here
Back to Hash Table Lab click
here
Copyright: Department of Computer Science, University of Regina.