Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public ListaGenerica<T> frontera() {
- ListaGenerica<T> lista = new ListaGenericaEnlazada<T>();
- if(this.esHoja()){
- lista.agregarFinal(this.getDatoRaiz());
- }
- else
- {
- if(!this.getHijoIzquierdo().esVacio()){
- ListaGenerica<T> lista2 = this.getHijoIzquierdo().frontera();
- for (int i =0 ; i<lista2.tamanio() ; i++ ){
- lista.agregarFinal(lista2.elemento(i));
- }
- }
- if(!this.getHijoDerecho().esVacio()){
- ListaGenerica<T> lista3 = this.getHijoDerecho().frontera();
- for (int i =0 ; i<lista3.tamanio() ; i++ ){
- lista.agregarFinal(lista3.elemento(i));
- }
- }
- }
- return lista;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement