Insert a Node at the Tail of a Linked List

  • + 4 comments

    In your code:

    if(head == null) {
        head = tmp;
        return head;
    } 
    

    Why not simply return tmp instead of re-assigning head to tmp and then returning head?

    Just curious. Thanks!