302
This commit is contained in:
@@ -11,17 +11,18 @@ TablaHash::TablaHash() {
|
||||
TablaHash::~TablaHash() {
|
||||
}
|
||||
|
||||
void TablaHash::insertar(Cuac nuevo) {
|
||||
Cuac* TablaHash::insertar(Cuac nuevo) {
|
||||
int pos = h(nuevo.usuario);
|
||||
list<Cuac>::iterator it = lista[pos].begin();
|
||||
while (it != lista[pos].end() && nuevo.comparar(*it)){
|
||||
it++;
|
||||
}
|
||||
if (it==lista[pos].end() || !nuevo.comparar(*it)) {
|
||||
lista[pos].insert(it--, nuevo);
|
||||
it++;
|
||||
lista[pos].insert(it, nuevo);
|
||||
it--;
|
||||
nElem++;
|
||||
}
|
||||
nElem++;
|
||||
return &*it;
|
||||
}
|
||||
|
||||
void TablaHash::consultar(string clave) {
|
||||
|
||||
Reference in New Issue
Block a user