plano
This commit is contained in:
parent
ca631b1082
commit
496b5f3465
Binary file not shown.
Binary file not shown.
|
|
@ -9,7 +9,6 @@ public class Agenda {
|
|||
//inserir todas as 26 letras do alfabeto...
|
||||
}
|
||||
|
||||
|
||||
public boolean pesquisarNome(String nome) {
|
||||
return pesquisarNome(raiz, nome);
|
||||
}
|
||||
|
|
@ -69,14 +68,14 @@ public class Agenda {
|
|||
return pesquisar(raiz, cpf);
|
||||
}
|
||||
|
||||
private boolean pesquisar(No i, int cpf) {
|
||||
private boolean pesquisar(No no, int cpf) {
|
||||
boolean resp = false;
|
||||
if (i != null) {
|
||||
resp = pesquisar(i.primeiro.prox, cpf);
|
||||
if (no != null) {
|
||||
resp = pesquisar(no.primeiro.prox, cpf);
|
||||
if(resp == false){
|
||||
resp = pesquisar(i.esq, cpf);
|
||||
resp = pesquisar(no.esq, cpf);
|
||||
if(resp == false){
|
||||
resp = pesquisar(i.dir, cpf);
|
||||
resp = pesquisar(no.dir, cpf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,15 +44,25 @@ public class Principal {
|
|||
* arvore.mostrarPre();
|
||||
*/
|
||||
arvore.inserir(4);
|
||||
arvore.caminharPre();
|
||||
arvore.inserir(35);
|
||||
arvore.caminharPre();
|
||||
arvore.inserir(10);
|
||||
arvore.caminharPre();
|
||||
arvore.inserir(13);
|
||||
arvore.caminharPre();
|
||||
arvore.inserir(3);
|
||||
arvore.caminharPre();
|
||||
arvore.inserir(30);
|
||||
arvore.caminharPre();
|
||||
arvore.inserir(15);
|
||||
arvore.caminharPre();
|
||||
arvore.inserir(12);
|
||||
arvore.caminharPre();
|
||||
arvore.inserir(7);
|
||||
arvore.caminharPre();
|
||||
arvore.inserir(40);
|
||||
arvore.caminharPre();
|
||||
arvore.inserir(20);
|
||||
arvore.caminharPre();
|
||||
|
||||
|
|
|
|||
|
|
@ -46,13 +46,11 @@ class DoidonaComTADsProntas {
|
|||
} else if(t1[i] == NULO){
|
||||
t1[i] = elemento;
|
||||
}else if(hashT2(elemento) == 0){
|
||||
int i = hashT3(elemento);
|
||||
|
||||
i = hashT3(elemento);
|
||||
if(t3[i] == NULO){
|
||||
t3[i] = elemento;
|
||||
} else {
|
||||
i = rehashT3(elemento);
|
||||
|
||||
if(t3[i] == NULO){
|
||||
t3[i] = elemento;
|
||||
} else {
|
||||
|
|
@ -67,32 +65,34 @@ class DoidonaComTADsProntas {
|
|||
System.out.println("ERRO!!!!");
|
||||
}
|
||||
}
|
||||
void remover (int valor){
|
||||
void remover (int elemento){
|
||||
}
|
||||
|
||||
boolean pesquisar (int valor){
|
||||
boolean pesquisar (int elemento){
|
||||
boolean resp = false;
|
||||
int pos = hashT1(valor);
|
||||
if(t1[pos] == valor){
|
||||
int pos = hashT1(elemento);
|
||||
if(elemento == NULO){
|
||||
resp = false;
|
||||
} else if(t1[pos] == elemento){
|
||||
resp = true;
|
||||
}else {
|
||||
pos = hashT2(valor);
|
||||
pos = hashT2(elemento);
|
||||
if (pos == 0){
|
||||
pos = hashT3(valor);
|
||||
if(t3[pos] == valor){
|
||||
pos = hashT3(elemento);
|
||||
if(t3[pos] == elemento){
|
||||
resp = true;
|
||||
}else{
|
||||
pos = rehashT3(valor);
|
||||
if(t3[pos] == valor){
|
||||
pos = rehashT3(elemento);
|
||||
if(t3[pos] == elemento){
|
||||
resp = true;
|
||||
}else{
|
||||
resp = arvoreBinaria.pesquisar(valor);
|
||||
resp = arvoreBinaria.pesquisar(elemento);
|
||||
}
|
||||
}
|
||||
}else if (pos == 1){
|
||||
resp = lista.pesquisar(valor);
|
||||
resp = lista.pesquisar(elemento);
|
||||
} else {
|
||||
resp = arvoreAVL.pesquisar(valor);
|
||||
resp = arvoreAVL.pesquisar(elemento);
|
||||
}
|
||||
}
|
||||
return resp;
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ class Principal {
|
|||
arv.inserir(array[i]);
|
||||
}
|
||||
arv.mostrar();
|
||||
/*
|
||||
for(int i = 0; i < array.length; i++){
|
||||
System.out.println("Pesquisar(" + array[i] + "):" + arv.pesquisar(array[i]));
|
||||
}
|
||||
|
|
@ -28,6 +29,7 @@ class Principal {
|
|||
|
||||
s = "gaga";
|
||||
System.out.println("Pesquisar(" + s + "):" + arv.pesquisar(s));
|
||||
*/
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue