4567WNE 2-1 8 10 6 public: 13 ESGARREN 28 15 16- 18- 19 21 22- 23 24 - 25 26 27 class DoubleHash 29 int hashTable: int c
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
4567WNE 2-1 8 10 6 public: 13 ESGARREN 28 15 16- 18- 19 21 22- 23 24 - 25 26 27 class DoubleHash 29 int hashTable: int c
question is given below. Question: Above is the partial implementation of the double hashing technique used for hash tables. Now, you are expected to perform the following tasks and modify the above implementation for the separate chaining technique. Just give the code for the below tasks. 1. Create a list array. 8. Use the list container class from the standard library. Re-write the constructor to initialize the list array. 2. a The constructor needs to receive the array size as an argument. 3. Re-write the code for the insert function so that it works for the separate chaining technique. a. Use hash1 for the separate chaining. b Use list's push back function } 16 2009
4567WNE 2-1 8 10 6 public: 13 ESGARREN 28 15 16- 18- 19 21 22- 23 24 - 25 26 27 class DoubleHash 29 int hashTable: int curr_size: int hashi(int key){ return (key TABLE_SIZE); } int hash2(int key) { return (PRIME (key PRIME)); } DoubleHash() { hashlable - new int [TABLE_SIZE]: curr_size = 0; for (int i=0; i<TABLE_SIZE: 1-) hashTable - -1; } void insertHash(int key) { int index - hashl(key); if (hashTable[index] - -1) { int index2 - hash2(key); int i = 1; while (1) 30 31 int newIndex - (index i if ChashTable[newIndex] index2)% TABLE_SIZE; -1) { key: hashTable[newIndex] break; i44: } else 32 hashTable[index] key; 33 curr_size=¹; 34 } 35 }; The