Created
March 22, 2012 05:15
-
-
Save thiagopnts/2156278 to your computer and use it in GitHub Desktop.
Estrutura de dados
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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