Advertisement
Mercedes

frontera AB

May 4th, 2016
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. public ListaGenerica<T> frontera() {
  2.  
  3. ListaGenerica<T> lista = new ListaGenericaEnlazada<T>();
  4. if(this.esHoja()){
  5. lista.agregarFinal(this.getDatoRaiz());
  6.  
  7. }
  8. else
  9. {
  10.  
  11. if(!this.getHijoIzquierdo().esVacio()){
  12.  
  13. ListaGenerica<T> lista2 = this.getHijoIzquierdo().frontera();
  14. for (int i =0 ; i<lista2.tamanio() ; i++ ){
  15. lista.agregarFinal(lista2.elemento(i));
  16. }
  17. }
  18. if(!this.getHijoDerecho().esVacio()){
  19. ListaGenerica<T> lista3 = this.getHijoDerecho().frontera();
  20. for (int i =0 ; i<lista3.tamanio() ; i++ ){
  21. lista.agregarFinal(lista3.elemento(i));
  22. }
  23. }
  24.  
  25. }
  26. return lista;
  27.  
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement