????/**
????* ?????????????????????
????* @param root
????* @param childNode
????* @return ???????????????????????????null
????*/
????public BinaryTreeNode<E> getParent(BinaryTreeNode<E> root?? BinaryTreeNode<E> childNode){
????if(root == null){
????return null;
????}
????if(root.leftChild == childNode || root.rightChild == childNode){
????return root;
????}
????if(getParent(root.leftChild?? childNode) != null){
????return getParent(root.leftChild?? childNode);
????}else{
????return getParent(root.rightChild?? childNode);
????}
????}
????/**
????* ??????????????????????洢???
????* @param root
????*/
????public void destoryBinaryTree(BinaryTreeNode<E> root){
????if(root != null){
????destoryBinaryTree(root.leftChild);
????destoryBinaryTree(root.rightChild);
????root = null;
????}
????}
????/**
????* ?????????????????????
????* @param root
????*/
????public void levelOrder(BinaryTreeNode<E> root){
????Queue<BinaryTreeNode<E>> queue = new LinkedBlockingQueue<BinaryTreeNode<E>>();
????BinaryTreeNode<E> pointer = root;
????/**
????* ??????????????????
????*/
????if(pointer != null){
????queue.add(pointer);
????}
????/*
????* ???в?????????????м????????????????????????????????????
????*/
????while(!queue.isEmpty()){
????pointer = queue.peek();  
????visit(pointer);
????queue.remove();
????if(pointer.leftChild != null){
????queue.add(pointer);
????}
????if(pointer.rightChild != null){
????queue.add(pointer);
????}
????}
????}
????/**
????* ????????????????
????* @param root
????*/
????public void preOrder(BinaryTreeNode<E> root){
????if (root == null){
????return;
????}             
????visit(root);
????preOrder(root.leftChild);
????preOrder(root.rightChild);
????}
????/**
????* ?????????????????
????* @param root
????*/
????public void nPreOrder(BinaryTreeNode<E> root){
????Stack<BinaryTreeNode<E>> stack = new Stack<BinaryTreeNode<E>>();
????BinaryTreeNode<E> pointer = root;
????while(!stack.isEmpty() || pointer != null){
????if(pointer != null){
????visit(pointer);
????if(pointer.rightChild != null){
????stack.push(pointer.rightChild);
????}
????pointer = pointer.leftChild;
????}else{
????pointer = stack.pop();
????}
????}
????}
????/**
????* ??????????
????* @param root
????*/
????public void inOrder(BinaryTreeNode<E> root){
????if (root == null){
????return;
????}  
????inOrder(root.leftChild);
????visit(root);
????inOrder(root.rightChild);
????}
????/**
????* ???????????1
????* @param root
????*/
????public void nInOrder(BinaryTreeNode<E> root){
????Stack<BinaryTreeNode<E>> stack = new Stack<BinaryTreeNode<E>>();
????BinaryTreeNode<E> pointer = root;
????while(pointer != null || !stack.isEmpty()){
????if(pointer != null){
????stack.push(pointer);
????pointer = pointer.leftChild;
????}else{
????pointer = stack.pop();
????visit(pointer);
????pointer = pointer.rightChild;              
????}
????}
????}
????/**
????* ???????????2
????* @param root
????*/
????public void nInOrders(BinaryTreeNode<E> root){
????Stack<BinaryTreeNode<E>> stack = new Stack<BinaryTreeNode<E>>();
????BinaryTreeNode<E> pointer = root;
????stack.push(pointer);
????while(!stack.isEmpty()){
????while(pointer != null){
????stack.push(pointer.leftChild);
????pointer = pointer.leftChild;
????}
????stack.pop();
????if(!stack.isEmpty()){
????pointer = stack.pop();
????visit(pointer);
????pointer = pointer.rightChild;
????stack.push(pointer);
????}
????}
????}
????/**
????* ?????????
????* @param root
????*/
????public void postOrder(BinaryTreeNode<E> root){
????if (root == null){
????return;
????}  
????postOrder(root.leftChild);
????postOrder(root.rightChild);
????visit(root);
????}
????/**
????* ??????????
????* @param root
????*/
????public void nPostOrder(BinaryTreeNode<E> root){
????Stack<BinaryTreeNode<E>> stack = new Stack<BinaryTreeNode<E>>(); //???????????????????????
????BinaryTreeNode<E> pointer = root;                                //????????
????BinaryTreeNode<E> preNode = root;                                //?????????????????
????while(!stack.isEmpty() || pointer != null){
????//?????????????????????????????
????while(pointer.leftChild != null){
????stack.push(pointer);
????pointer = pointer.leftChild;
????}
????/*
????* ???????????????????????
????* 1?????????????????????????????????????
????* 2??????????????????????????????????????????????????????????????
????* ???????μ???????????ж????
????*/
????while((pointer != null && pointer.rightChild == null) || pointer.rightChild == preNode){
????visit(pointer);
????preNode = pointer;
????if(stack.isEmpty()){
????return;
????}
????pointer = stack.pop();
????}
????stack.push(pointer);
????pointer = pointer.rightChild;
????}
????}
????/**
????* ?????????
????* @param current
????*/
????public void visit(BinaryTreeNode<E> current){
????if(current != null && current.element != null){
????System.out.println(current.element);
????}else{
????System.out.println("null");
????}
????}
????}
????3. ?ο?????
????1. java????????????????????????
????2. java??????????????—–?????
????3. Java??????????????????/???????
????4. Java?????????????????????????и??£?