March 2019
Intermediate to advanced
336 pages
9h 9m
English
The LastNode method of LinkedList returns the node at the end of the list. The list is traversed to check whether nextNode is nil from nextNode of headNode, as follows:
//LastNode method returns the last Nodefunc (linkedList *LinkedList) LastNode() *Node{ var node *Node var lastNode *Node for node = linkedList.headNode; node != nil; node = node.nextNode { if node.nextNode ==nil { lastNode = node } } return lastNode}
Read now
Unlock full access