public void insertNode(Node n, String s) { if (n == null) { n = new NLNode(s); n.Left = null; n.Right = null; } else if (n.Left != null && n.Right == null) { insertNode(n.Right, s); ; } else if (n.Left == null) { insertNode(n.Left, s); } else { // insert } }
public Node Reverse(Node head) { if (head == null) { return null; } Node current = head; head = null; while (current != null) { Node next = current.Right; current.Right = head; head = current; current = next; } return head; }