Hashtabelle/Quelle.cpp

47 lines
955 B
C++

#pragma once
#include "HashTabelle.h"
#include <iostream>
#include <string>
#include <taskflow/taskflow.hpp>
using namespace std;
struct Customer {
int id;
string vorname;
string nachname;
friend ostream& operator<<(ostream& os, const Customer& c) {
os << "Id: " << c.id << "\n" << "Vorname: " << c.vorname << "\n" << "Nachname: " << c.nachname << "\n";
return os;
}
};
int main() {
Customer c{ 20, "Max", "Mustermann" };
Customer d{ 30, "Tom", "Mot" };
HashTable<Customer> table = HashTable<Customer>(10);
table.insert(20, &c);
table.insert(30, &c);
table.insert(21, &c);
table.insert(21, &d);
std::cout << table.search(30) << std::endl;
table.remove(30);
std::cout << table.search(30) << std::endl;
std::cout << table.search(21) << std::endl;
std::cout << table.search(20) << std::endl;
table.remove(40);
table.restructure();
table.print();
}