Arboles binarios

Páginas: 4 (994 palabras) Publicado: 12 de febrero de 2011
public class Arbol_BST {
Nodo_Doble Raiz;
private Nodo_Doble N;
private Nodo_Doble PadreN;

public Arbol_BST() {
}
private voidBuscarNodo(int x){
PadreN=null;
N=Raiz;
while(N!=null){
PadreN=N;
if(xN.getData())
N=N.getHD();
elsereturn;

}
}
}
public int Cant_HijosIzq(){
int x=Cant_HijosIzq1(Raiz);
return x;
}private int Cant_HijosIzq1(Nodo_Doble T){
if(T==null)
return 0;
else{
if(Hoja(T))
return 1;
else{int cant;
int a=Cant_HijosIzq1(T.getHI());
int b=Cant_HijosIzq1(T.getHD());
if(T.getHI()!=null)
cant=a+b;else
cant=b;
return b;
}
}
}

/* public boolean Heap(){
boolean x=Heap1(Raiz);return x;
}
private boolean Heap1(NodoDoble T){
N=Raiz;
if(N==null)
return false;
else{
if(Hoja(T))return true;
else{
boolean sw=Heap1(T.getHI());
BuscarNodo(T.getData());

}
}
}*/private boolean Hoja(Nodo_Doble T){
return (T!=null && T.getHI()==null && T.getHD()==null);
}
public void Insertar(int x) {
if(Raiz==null){Raiz=new Nodo_Doble();
Raiz.setData(x);
}else{
Nodo_Doble P=Raiz;
Nodo_Doble Ant=null;
while (P!=null) {...
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • Árboles Binarios
  • Arboles Binarios
  • Arboles binarios
  • Arboles Binarios
  • Arboles Binarios
  • Arboles binarios
  • Arboles binarios
  • Arboles Binarios

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS