Question | Answer |
public class Ccolas { } | Nodo frente, fin; int size; |
contructor cola | public Ccolas(){ frente=fin=null; size=0; } |
push(){ } | public void push(char e){ // Nodo nodo =new Nodo(e,null); if(size==0){ frente = nodo; } else{ fin.getSig(); fin=nodo; size++; } } |
pop(){ } | public char pop(){// if(isEmpty()){ System.out.println("cola vacia"); return'0'; } char aux = (char) frente.getElem(); frente = frente.getSig(); size--; if(size==0) fin=null; return aux; } |
size(){ } | public int size(){// return size; } |
isEmpty(){ } | public boolean isEmpty(){// if (size==0) return true; return false; } |
frente(){ } | public char frente(){// if(isEmpty()){ System.out.println("la cola esta vacia"); return '0'; } return (char) frente.getElem(); } |
Want to create your own Flashcards for free with GoConqr? Learn more.