Advertisement
dcndrd

Copia Pilha

Oct 1st, 2014
25
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.27 KB | None | 0 0
  1. public LinkStack copia_pilha(LinkStack P){
  2.     LinkStack aux = new LinkStack();
  3.     LinkStack copy = new LinkStack();
  4.    
  5.     while(!P.isEmpty())
  6.         aux.push(p.pop());
  7.  
  8.     while(!aux.isEmpty()){
  9.         int data = aux.pop();
  10.         p.push(data);
  11.         copy.push(data);
  12.     }
  13.    
  14.     return copy;
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement