void Practica1E() { Cola cola = new Cola(); cola.InicializarCola(); cola.Acolar(2); cola.Acolar(2); cola.Acolar(3); cola.Acolar(2); cola.Acolar(1); bool capicua = Cola.EsCapicuaReduced(cola); Cola cola2 = new Cola(); cola2.InicializarCola(); cola2.Acolar(1); cola2.Acolar(2); cola2.Acolar(3); cola2.Acolar(3); cola2.Acolar(2); cola2.Acolar(1); capicua = Cola.EsCapicuaReduced(cola2); }
public static Cola InvertirCola(Cola cola) { Cola colaAux = cola; Cola a = new Cola(); a.InicializarCola(); int[] aux = new int[cola.Contar()]; int i = 0; while (!colaAux.ColaVacia()) { aux[i] = colaAux.Primero(); i++; colaAux.Desacolar(); } for (int j = aux.Length - 1; j >= 0; j--) { a.Acolar(aux[j]); } return(a); }
static void Practica1F() { Cola cola = new Cola(); cola.InicializarCola(); cola.Acolar(2); cola.Acolar(2); cola.Acolar(3); cola.Acolar(2); cola.Acolar(1); Cola cola2 = new Cola(); cola2.InicializarCola(); cola2.Acolar(2); cola2.Acolar(2); cola2.Acolar(3); cola2.Acolar(2); cola2.Acolar(2); bool prueba = Cola.SonInversas(cola, cola2); }