Question: C++ Programming Assignments: most of the code needed is posted below I just need help with certain hashing functions! thanks!! 1.0 Overview In this programming
| C++ Programming Assignments: most of the code needed is posted below I just need help with certain hashing functions! thanks!! 1.0 Overview | ||
| In this programming assignment you will have the opportunity to study the effects of different hash functions on the efficiency of inserting data into a hash table. | ||
| 2.0 Requirements | ||
| The student shall define, develop, document, prototype, test, and modify as required the software system. | ||
| 2.1 Functional Requirements | ||
| 2.1.1 The software shall include three functions each of which implements a different hash function. Hash functions may be those studied in class or adaptations of those functions. | ||
| 2.1.2 The software shall include three functions each of which implements a different double hash function. One and only one of these double hash functions must be for linear probing, i.e. returns an increment value of 1. | ||
| 2.1.3 Each hash function shall be tested using each of the double hash functions as a means of collision resolution. This means a total of nine tests. A list of 50 4-letter keys, each with some associated data will be provided for the testing. | ||
| 2.1.4 In addition to the regular documentation a written report on the results will also be prepared. This consist of printouts of diagrams of the results of the hash tests and a count of the number of collisions in each test. Sample code can be found in the "Hints" section for producing a diagram. | ||
| 3.0 Deliverables | ||
|
| These products shall be delivered to the instructor electronically via e-mail as specified below. 3.1 Sprint Report -- The student shall provide filled out Sprint Report form for instructor approval NLT (Not Later Than) Monday, July 31. 3.2 Program source files -- The student shall provide fully tested electronic copies of the .cpp and .h files. These files must be submitted to the instructor via e-mail. The files shall be delivered NLT Monday, July 31. 3.3 Hash Results Report -- The student shall provide an electronic report on the results of the hash tests. (See instructions below.) This can be in plain .txt or .doc format. Our professor gives us most of the code and says we need to fill in certain functions: any help is much appreciated! Here are code snippets our professor gives us: Program Outline The following is a brief pseudocode outline of how the program should be organized. for each of three hash functions for each of three double hash (probe increment) functions Initialize the table to empty Open the data file containing keys and associated data. for each key/data set read from the data file Call HashInsert(key, data, hashNum, dHashNum). The return value from this function should be a count of the number of collisions encountered for this key. This should be added to a running total. HashInsert should call one of the Hash functions and set the probe increment to the return value from one of the functions. This will result in the following 9 tests: 1. Hash_01 using probe increment from DoubleHash_01 2. Hash_01 using probe increment from DoubleHash_02 3. Hash_01 using probe increment from DoubleHash_03 4. Hash_02 using probe increment from DoubleHash_01 5. Hash_02 using probe increment from DoubleHash_02 6. Hash_02 using probe increment from DoubleHash_03 7. Hash_03 using probe increment from DoubleHash_01 8. Hash_03 using probe increment from DoubleHash_02 9. Hash_03 using probe increment from DoubleHash_03 Insert key and data into table Close data file Print the results of the run (total number of collisions and diagram of the table). end loop for each double hash end loop for each hashNote: Much of the program design is being given to you for this programming assignment. The reason for this is that the primary purpose of this assignment is to explore different hash functions and collision resolution techniques. It is not just a programming activity. Sample code Use the following code snippets in main() to read data from the text file, insert it into the table, count the number of collisions, and print the results. You may place all of the hash functions and double hash functions in a C++ class but that is not required. Code Snippets are just that, pieces of code. You cannot just copy all of the code below, paste it into your program and expect it to work.
#include This is the sample data file: Select all of the text below and paste it into a text file. Save the file as an MS DOS text file under the name of P4DATA.TXT AARD 1 ABAN 2 ABAS 3 ABAT 4 ABAX 5 ABEC 6 ABER 7 ABIL 8 ABOD 9 ABON 10 EARD 11 EBAN 12 EBAS 13 EBAT 14 EBAX 15 EBEC 16 EBER 17 EBIL 18 EBOD 19 EBON 20 IARD 21 IBAN 22 IBAS 23 IBAT 24 IBAX 25 IBEC 26 IBER 27 IBIL 28 IBOD 29 IBON 30 OARD 31 OBAN 32 OBAS 33 OBAT 34 OBAX 35 OBEC 36 OBER 37 OBIL 38 OBOD 39 OBON 40 UARD 41 UBAN 42 UBAS 43 UBAT 44 UBAX 45 UBEC 46 UBER 47 UBIL 48 UBOD 49 UBON 50
| |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
