Advertisement
Guest User

Untitled

a guest
May 28th, 2015
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. public void makeRoom(String w) {
  2. if (w.compareTo(left.peek()) < 0){
  3. while (w.compareTo(left.peek()) < 0){
  4. left.pop();
  5. }
  6. left.push(w);
  7. }
  8. if (w.compareTo(left.peek()) > 0 && w.compareTo(right.peek()) > 0){
  9. while (w.compareTo(right.peek()) > 0){
  10. right.pop();
  11. }
  12. right.push(w);
  13. }
  14. if (w.compareTo(left.peek()) > 0 && w.compareTo(right.peek()) < 0){
  15. left.push(w);
  16. }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement