Exemplo n.º 1
0
        public override string ToString()
        {
            string stringPila = "";
            Nodo   t          = top;

            if (t != null)
            {
                stringPila += t.ToString();
                t           = t.Siguiente;
                while (t != null)
                {
                    stringPila += "," + t.ToString();
                    t           = t.Siguiente;
                }
                return(stringPila);
            }
            else
            {
                return("La pila esta vacia");
            }
        }
Exemplo n.º 2
0
        public override string ToString()
        {
            string stringCola = "";
            Nodo   h          = head;

            if (h != null)
            {
                stringCola += h.ToString();
                h           = h.Siguiente;
                while (h != null)
                {
                    stringCola += "," + h.ToString();
                    h           = h.Siguiente;
                }
                return(stringCola);
            }
            else
            {
                return("La cola esta vacia");
            }
        }