Skip to content

Instantly share code, notes, and snippets.

@thiagopnts
Created March 22, 2012 05:15
Show Gist options
  • Save thiagopnts/2156278 to your computer and use it in GitHub Desktop.
Save thiagopnts/2156278 to your computer and use it in GitHub Desktop.
Estrutura de dados
//A primeira:
public int size() {
for(int i = 0; i < vet.length; i++) {
if(vet[i] == null)
return i;
}
}
public boolean push(Livro l) {
if(this.size < MAX) {
this.vet[this.size()] = l;
return true;
}
return false;
}
public Livro pop() {
if(this.size != 0) {
Livro l= vet[this.size()-1];
vet[this.size()-1] = null;
return l;
}
throw new Exception("vazia");
}
//A segunda:
No aux2;
aux2 = aux;
aux = aux.getProx();
aux2.setProx(cabeca);
aux = cabeca;
aux.setProx(cabeca.getProx());
cabeca.setProx(null);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment