I have several final projects in the subject Data Structure. In all I'm doing well, but in this specific, for more than I try, I can not find the solution.
The problem proposes the following:
Stack of pilitas: The elements of ED PILITA are of any type of data, the elements of the ED PILA are of type PILA.
So far, I have taken these methods from the class PILITA
public class pilita{
Object vectorPila[];
int tope;
public pilita(int tam){
vectorPila=new Object[tam];
tope=-1;
}
public void inicializarPila(){
tope=-1;
}
public void push(Object dato){
tope++;
vectorPila[tope]=dato;
}
public Object pop(){
Object fuera=vectorPila[tope];
tope--;
return fuera;
}
public boolean pilaVacia(){
return tope==-1;
}
public boolean pilaLlena(){
return vectorPila.length-1==tope;
}
public Object cima(){
return vectorPila[tope];
}
public Object contar(){
return tope+1;
}
}
But the problem is that I do not know how the combination of PILA with PILITA could be implemented. If you could help me find a solution, I would greatly appreciate it.