All pastes #2069830 Raw Edit

Something

public java v1 · immutable
#2069830 ·published 2011-05-27 04:38 UTC
rendered paste body
package Node;public class BSTnode {    private BSTnode left;  // pointer for the left child node    private BSTnode right; // pointer for the right child node        public int nodeData;        public BSTnode (int newData) {                left = null;        right = null;                nodeData = newData;    }        public void insertNode (int nodeInteger) {                 if (nodeInteger < nodeData) { /* if the node to be inserted is smaller than the                                          previous node, it is inserted in the left sub-tree                                      */            if (left == null)                            left = new BSTnode (nodeInteger);                                                                   else                             left.insertNode (nodeInteger);            }                 else if (nodeInteger > nodeData) { /* if the node to be inserted is larger than the                                               previous node, it is inserted in the right sub-tree                                           */            if (right == null)                            right = new BSTnode (nodeInteger);                                else                                 right.insertNode (nodeInteger);            }    }        public BSTnode getLeft() {                return left;    }        public BSTnode getRight() {                return right;    }        public int getData() {                return nodeData;    }        public void show() {                System.out.println(getData());    }}