Programming Assignment 1

advertisement
Programming Assignment 2
Performance Analysis of
Hashing Algorithms and Skip list
Due on 24:00 (Sunday) May 31, 2009
(This is a “HARD” deadline, and late homework will not be
accepted !!!)
1. Specification.
I. The input format of the program (HASH_Master & Skip_list)
%>./hash_master (Enter)
The number of elements : 2000000 (Enter)
The number of hash tables : 4000000 (Enter)
1. Division Method (Normal Hash Function)
2. Multiplication Method (Normal Hash Function)
3. Perfect Hashing
Choose the type of Hashing: 2 (Enter)
1. Linear Probing
2. Double Hashing
Choose the type of a probing method : 2 (Enter)
Build a hash table and insert 2000000 random keys…
Total number of collisions : 23213
Now, start searching all keys in increasing order…
Time elapsed : 3 sec 523 msec 432 usec
%>
%>./skip_list (Enter)
The number of elements : 2000000 (Enter)
Insert 2000000 random numbers to build the skip list…
Maximum height : 8
Start searching all keys in increasing order…
The total number of moves : 243123
Average value : 123122
Time elapsed : 3 sec 23 msec 213 usec
II. When choosing “Perfect Hashing”, the program doesn’t have to
print out the probing menu.
2. Requirements
(1). When submitting the homework, you need to create a compressed
tar file using the following command.
Example)
(home directory:/home/jhs)
.
..
HW1 (You don’t need to look at this directory)
HW2 (You have to create this directory !!!)
 .
 ..
 Makefile
 hash_master.h
 hash_master.c
(This
file
should
contain
the
main()
function)
 division_method.c
 multiplication_method.c
 universal_hash.c
 perfect_hash.c
 skip_list.h
 skip_list.c (This file should also contain the main()
function)
at the home directory (cd (Enter))
To compress,
%: /home/jhs>tar cvzf HW2_200912345_HongGilDong.tgz ./HW2 (Enter)
Then
you
will
find
a
compressed
tar
file
(HW2_200912345_HongGilDong.tgz ) in your home directory.
(2). Make sure that before submitting the tar file, you must check
whether it can be decompressed correctly and compiled in a
right way. Otherwise, TA will relentlessly give you a “0”
point.
(3). You don’t need to write or submit any report for your code.
However, your code “MUST” contain well structured comments,
which explain each part of you code in detail and make TA
clearly understand it.
(4). The last thing you are required to fulfill is analyzing the
performance
of
each
hashing
algorithm
&
a
skip
list
with
varying the size of the input element and the table size (only
in hashing) and hash functions (only in hashing). This work
entails some graphical representations (using Excel or other
tools) and thorough explanations for the performance results
you will get. This part is as important as the coding work is.
Please be critical on your results. The performance results
with beautiful critics should be submitted in a separate file,
e.g., hwp or doc.
3. Makefile (you have to create your own makefile)
Reference site : http://kldp.org/KoreanDoc/html/GNU-Make/GNU-Make.html
4. Submitting Homework
TA’s email : sg1075@gmail.com
Email Subject: [Algorithm] 200912345 HongGilDong HW-2
Attachment: HW2_200912345_HongGilDong.tgz, HW2_200912345_HongGilDong.(hwp/doc)
Download