public String toString()
        {
            if (this.esVacia())
            {
                return("Lista Vacia");
            }
            String r = "";

            for (NodoBtree <T> x = this.cabeza.getSig(); x.getInfo() != null; x = x.getSig())
            {
                r += x.getInfo().ToString() + "<->";
            }
            return(r);
        }
 public T eliminar(int i)
 {
     try
     {
         NodoBtree <T> x;
         if (i == 0)
         {
             x = this.cabeza.getSig();
             this.cabeza.setSig(x.getSig());
             this.cabeza.getSig().setAnt(this.cabeza);
             x.setSig(null);
             x.setAnt(null);
             this.tamanio--;
             return(x.getInfo());
         }
         x = this.getPos(i - 1);
         if (x == null)
         {
             return(default(T));
         }
         NodoBtree <T> y = x.getSig();
         x.setSig(y.getSig());
         y.getSig().setAnt(x);
         y.setSig(null);
         y.setAnt(null);
         this.tamanio--;
         return(y.getInfo());
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
     return(default(T));
 }
        public void insertarOrdenado(T info)
        {
            if (this.esVacia())
            {
                this.insertarAlInicio(info);
            }
            else
            {
                NodoBtree <T> x = this.cabeza;
                NodoBtree <T> y = x;
                x = x.getSig();
                while (x != this.cabeza)
                {
                    int rta = Comparable.Comparador(info, x.getInfo());

                    if (rta < 0)
                    {
                        break;
                    }
                    y = x;
                    x = x.getSig();
                }
                if (x == cabeza.getSig())
                {
                    this.insertarAlInicio(info);
                }
                else
                {
                    y.setSig(new NodoBtree <T>(info, x, y));
                    x.setAnt(y.getSig());
                    this.tamanio++;
                }
            }
        }
Example #4
0
        public String toString()
        {
            String        msj = "";
            NodoBtree <T> p   = tope;

            while (p != null)
            {
                msj += p.getInfo().ToString() + "->";
                p    = p.getSig();
            }
            return(msj);
        }
Example #5
0
        public String toString()
        {
            String        msj = "";
            NodoBtree <T> c   = this.inicio.getSig();

            while (c != inicio)
            {
                msj += c.getInfo().ToString() + "->";
                c    = c.getSig();
            }
            return(msj);
        }
        public int getIndice(int dato)
        {
            int i = 0;

            for (NodoBtree <T> x = this.cabeza.getSig(); x != this.cabeza; x = x.getSig())
            {
                if (x.getInfo().Equals(dato))
                {
                    return(i);
                }
                i++;
            }
            return(-1);
        }
Example #7
0
        public T deColar()
        {
            if (this.esVacia())
            {
                return(default(T));
            }
            NodoBtree <T> x = this.inicio.getSig();

            this.inicio.setSig(x.getSig());
            x.getSig().setAnt(inicio);
            x.setSig(null);
            x.setAnt(null);
            this.tamanio--;
            return(x.getInfo());
        }
Example #8
0
        public T desapilar()
        {
            if (this.esVacia())
            {
                return(default(T));
            }
            NodoBtree <T> x = this.tope;

            this.tope = tope.getSig();
            this.tamanio--;
            if (tamanio == 0)
            {
                this.tope = null;
            }
            return(x.getInfo());
        }
 public T get(int i)
 {
     try
     {
         NodoBtree <T> x = this.getPos(i);
         if (x == null)
         {
             return(default(T));
         }
         return(x.getInfo());
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
     return(default(T));
 }