Ejemplo n.º 1
0
    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
      }
    }
Ejemplo n.º 2
0
  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;
  }