Init
This commit is contained in:
30
P2/ADS_P2_2_Hashtable/main.cpp
Executable file
30
P2/ADS_P2_2_Hashtable/main.cpp
Executable file
@@ -0,0 +1,30 @@
|
||||
#define CATCH_CONFIG_RUNNER
|
||||
#include "catch.h"
|
||||
#include <iostream>
|
||||
#include "hashtable.h"
|
||||
#include <cstdlib> // Für rand() und srand()
|
||||
#include <ctime> // Für time()
|
||||
|
||||
int main() {
|
||||
Catch::Session().run();
|
||||
|
||||
// Initialisiere den Zufallsgenerator
|
||||
srand(static_cast<unsigned int>(time(0)));
|
||||
|
||||
int option = 1;
|
||||
while (0 < option && option < 4) {
|
||||
std::cout << "Wählen Sie die Sondierungsmethode : \n1 - linear\n2 - quadratisch\n3 - Doppeltes Hashing\n> ";
|
||||
std::cin >> option;
|
||||
HashTable H(1000, 0.6, option);
|
||||
|
||||
for (int i = 0; i < 200; ++i) {
|
||||
int randomValue = 1000 + rand() % 501;
|
||||
H.insert(randomValue);
|
||||
}
|
||||
|
||||
std::cout << "Anzahl der Kollisionen: " << H.getCollisionCount() << std::endl;
|
||||
}
|
||||
|
||||
system("pause");
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user