Loading...
Searching...
No Matches
Implementation of hash chains. More...
#include <cmath>
#include <iostream>
#include <memory>
#include <vector>
Go to the source code of this file.
Implementation of hash chains.
Definition in file chaining.cpp.
◆ main()Main function
Definition at line 133 of file chaining.cpp.
133 {
134 intc = 0, x = 0, mod = 0,
h= 0;
135 std::cout << "Enter the size of Hash Table. = " << std::endl;
136 std::cin >> mod;
137
139
140 bool loop = true;
141 while (loop) {
142 std::cout << std::endl;
143 std::cout << "PLEASE CHOOSE -" << std::endl;
144 std::cout << "1. Add element." << std::endl;
145 std::cout << "2. Find element." << std::endl;
146 std::cout << "3. Generate Hash." << std::endl;
147 std::cout << "4. Display Hash table." << std::endl;
148 std::cout << "5. Exit." << std::endl;
149 std::cin >> c;
150 switch (c) {
151 case 1:
152 std::cout << "Enter element to add = " << std::endl;
153 std::cin >> x;
157 break;
158 case 2:
159 std::cout << "Enter element to search = " << std::endl;
160 std::cin >> x;
163 break;
164 case 3:
165 std::cout << "Enter element to generate hash = " << std::endl;
166 std::cin >> x;
167 std::cout << "Hash of " << x << " is = " << mychain.hash(x)
168 << std::endl;
169 break;
170 case 4:
171 mychain.display();
172 break;
173 default:
174 loop = false;
175 break;
176 }
177 std::cout << std::endl;
178 }
179
180
181
182
183
184
185 return 0;
186}
Chain class with a given modulus.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4