We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
In the 3rd line you return a new Node object. I thought we were supposed to return only the head object. Can you explain this part? My understanding with linked list is that the head never has any data but is used to reference the first element in the list, yet you return a single Node with data and no head.
Insert a Node at the Tail of a Linked List
You are viewing a single comment's thread. Return to all comments →
In the 3rd line you return a new Node object. I thought we were supposed to return only the head object. Can you explain this part? My understanding with linked list is that the head never has any data but is used to reference the first element in the list, yet you return a single Node with data and no head.