Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class BinaryTreeQueue{
- private class BTQNode{
- public BTQNode(BinaryTree bt){
- this.content = bt;
- }
- public BTQNode next;
- public BinaryTree content;
- public void setNext(BTQNode next){this.next = next;}
- }
- BTQNode start;
- public void insert(BinaryTree bt){
- BTQNode current = start;
- if(start == null) start = new BTQNode(bt);
- else {
- while(current.next !=null) current = current.next;
- current.next = new BTQNode(bt);
- }
- }
- public BinaryTree pull(){
- BTQNode temp = start;
- if(start.next != null) start = start.next;
- return temp.content;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement