Hello I just need to fix some things from my C++ code. I want tohave your expertise by fixing the co

Need your ASSIGNMENT done? Use our paper writing service to score better and meet your deadline.


Order a Similar Paper HERE Order a Different Paper HERE

Hello I just need to fix some things from my C++ code. I want tohave your expertise by fixing the code to meet the requirements. Ifit possible, display a capture for the output. I am using visualstudio 2015. Thanks. Current Code: #include #include #include #include #include #include using namespace std; //const int Position_Table_Hash = 1000; class StudentHT { struct RecType { int id; string fname; string lname; }; struct NodeType { int id; string fname; string lname; NodeType *nextNode; }; NodeType **hashTablePtr; int hashTableSize; int numberOfNodesSearches; int numberOfIDSearched; double avgNumberOfSearches; // Constructor StudentHT(int htSize) { hashTableSize = htSize; // creating hash table – hash table with pointers //hashTablePtr = (NodeType *) malloc (sizeof( struct NodeType*)* hashTableSize); hashTablePtr = new NodeType*[hashTableSize]; } int hashFunction(int studentID) { // hash Algorithm int hashValue = studentID % hashTableSize; return hashValue; } void insert(RecType item) { //calculate hash int hashValue = hashFunction(item.id); // store the item in hash table struct NodeType * newItem = new struct NodeType; // Copy item to NodeType item newItem->id = item.id; newItem->fname = item.fname; newItem->lname = item.lname; //If it is first entry in the hash table position if (hashTablePtr[hashValue] == NULL) { hashTablePtr[hashValue] = newItem; } else { // Insert node in the linked list struct NodeType *temp = hashTablePtr[hashValue]; while (temp->nextNode != NULL) { temp = temp->nextNode; } temp->nextNode = newItem; } } RecType Search(RecType item) { numberOfIDSearched++; // Increment search IDs //calculate hash int hashValue = hashFunction(item.id); // search the item RecType *itemSearch = new RecType; if (hashTablePtr[hashValue] != NULL) { struct NodeType *temp = hashTablePtr[hashValue]; temp = hashTablePtr[hashValue]; while (temp != NULL) { // item found numberOfNodesSearches++; //Increment number of node searches if (temp->id == item.id) { itemSearch->id = temp->id; itemSearch->fname = temp->fname; itemSearch->lname = temp->lname; return *itemSearch; } temp = temp->nextNode; } } // return item with id -1 itemSearch->id = -1; return *itemSearch; } void startStatistics() { // Initialisation numberOfIDSearched = 0; numberOfNodesSearches = 0; avgNumberOfSearches = 0; } void endStatistics() { // calculate avg searches avgNumberOfSearches = (double) numberOfNodesSearches /numberOfIDSearched; } void displayStatistics() { cout
1376
8026
2791
3199
1390
4042
3624
6053
2252
237
6957
6791
6505
2695
3155
2083
1070
4372
3827
8395
3210
4262
6809
3760
7909
4412
8823
4200
6016
2677
2635
3657
8518
8518
2408
879
9424
4061
1620
5971
9693
1420
3454
4984
2274
1768
9546
4061
8419 Add.txt 200 6929
6618
6741
1948
7601
2154
3286
3917
7909
6296
687
1620
8419
8606
3303
9873
6957
2587
8573
9686
6447
7995
2319
4984
4372
8026
2076
9880
6317
4260
188
7106
1812
7294
4766
6053
4494
2890
8290
5940
8207
6232
8093
5971
2791
2089
5800
4042
2677
4773
4930
163
6470
2252
6715
9916
3199
5873
1420
3657
2408
2635
8157
6259
6016
1390
8470
2595
5584
218
5572
1151
420
1763
879
9156
4200
2353
9530
1621
1264
1240
1194
3827
8395
8730
3210
734
1080
428
4670
7307
3464
6374
2519
8774
7606
4175
4087
6505
5701
9176
7925
4061
3034
2936
1203
1873
9338
3848
1070
2329
788
6528
5926
4360
2274
5506
3102
1890
4667
1540
4262
9867
7821
1188
104
580
8282
8823
144
2695
6481
3635
5151
2512
3454
159
1569
5423
9716
855
237
8748
9546
1795
6157
554
1619
7466
3760
2239
5587
3155
4412
1346
3646
9693
6791
3926
3955
5792
2278
7242
6595
9833
4538
4751
673
5753
5694
6020
4511
2790
1065
1259
6809
1376
6023
4028
8518
1661
9504
7224
3624
7956
1801
9966
2083
234
1985
9832
9310
5082
9424
8829
1768
8837
2786
1258 . . .